New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dromo-uploader-js

Package Overview
Dependencies
Maintainers
1
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dromo-uploader-js - npm Package Compare versions

Comparing version 2.0.16 to 2.0.17

2

dist/DromoUploader.js

@@ -15,3 +15,3 @@ var DromoUploader=function(){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e}).apply(this,arguments)};function n(e,n,t,r){return new(t||(t=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,a)}c((r=r.apply(e,n||[])).next())}))}function t(e,n){var t,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=n.call(e,s)}catch(e){i=[6,e],r=0}finally{t=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var r,o,i,s,a,c,l={IFRAME_URL:"https://widget.dromo.io/"}.IFRAME_URL;!function(e){e.INIT_IFRAME="INIT_IFRAME"}(r||(r={})),function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(o||(o={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(i||(i={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NotInIframe="NotInIframe",e.NoIframeSrc="NoIframeSrc"}(s||(s={})),function(e){e.DataCloneError="DataCloneError"}(a||(a={})),function(e){e.Message="message"}(c||(c={}));const u={"http:":"80","https:":"443"},d=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,h=["file:","data:"];const f=({name:e,message:n,stack:t})=>({name:e,message:n,stack:t});let m=0;var p=()=>++m,v=(e,n,t,r,a)=>{const{localName:l,local:u,remote:d,originForSending:h,originForReceiving:f}=n;let m=!1;a(`${l}: Connecting call sender`);const v=e=>(...n)=>{let t;a(`${l}: Sending ${e}() call`);try{d.closed&&(t=!0)}catch(e){t=!0}if(t&&r(),m){const n=new Error(`Unable to send ${e}() call due to destroyed connection`);throw n.code=s.ConnectionDestroyed,n}return new Promise(((t,r)=>{const s=p(),m=n=>{if(n.source!==d||n.data.penpal!==o.Reply||n.data.id!==s)return;if(n.origin!==f)return void a(`${l} received message from origin ${n.origin} which did not match expected origin ${f}`);const h=n.data;a(`${l}: Received ${e}() reply`),u.removeEventListener(c.Message,m);let p=h.returnValue;h.returnValueIsError&&(p=(e=>{const n=new Error;return Object.keys(e).forEach((t=>n[t]=e[t])),n})(p)),(h.resolution===i.Fulfilled?t:r)(p)};u.addEventListener(c.Message,m);const v={penpal:o.Call,id:s,methodName:e,args:n};d.postMessage(v,h)}))};return t.reduce(((e,n)=>(e[n]=v(n),e)),e),()=>{m=!0}},w=(e,n,t,r,s)=>{const{destroy:l,onDestroy:u}=r;let d,h;const m={};return r=>{if(r.origin!==n)return void s(`Parent: Handshake - Received ACK message from origin ${r.origin} which did not match expected origin ${n}`);s("Parent: Handshake - Received ACK");const p={localName:"Parent",local:window,remote:r.source,originForSending:t,originForReceiving:n};d&&d(),d=((e,n,t)=>{const{localName:r,local:s,remote:l,originForSending:u,originForReceiving:d}=e;let h=!1;const m=e=>{if(e.source!==l||e.data.penpal!==o.Call)return;if(e.origin!==d)return void t(`${r} received message from origin ${e.origin} which did not match expected origin ${d}`);const s=e.data,{methodName:c,args:m,id:p}=s;t(`${r}: Received ${c}() call`);const v=e=>n=>{if(t(`${r}: Sending ${c}() reply`),h)return void t(`${r}: Unable to send ${c}() reply due to destroyed connection`);const s={penpal:o.Reply,id:p,resolution:e,returnValue:n};e===i.Rejected&&n instanceof Error&&(s.returnValue=f(n),s.returnValueIsError=!0);try{l.postMessage(s,u)}catch(e){if(e.name===a.DataCloneError){const n={penpal:o.Reply,id:p,resolution:i.Rejected,returnValue:f(e),returnValueIsError:!0};l.postMessage(n,u)}throw e}};new Promise((e=>e(n[c].apply(n,m)))).then(v(i.Fulfilled),v(i.Rejected))};return s.addEventListener(c.Message,m),()=>{h=!0,s.removeEventListener(c.Message,m)}})(p,e,s),u(d),h&&h.forEach((e=>{delete m[e]})),h=r.data.methodNames;const w=v(m,p,h,l,s);return u(w),m}};var g=e=>{let{iframe:n,methods:t={},childOrigin:r,timeout:i,debug:a=!1}=e;const l=(e=>(...n)=>{e&&console.log("[Penpal]",...n)})(a),f=(()=>{const e=[];let n=!1;return{destroy(t){n=!0,e.forEach((e=>{e(t)}))},onDestroy(t){n?t():e.push(t)}}})(),{onDestroy:m,destroy:p}=f;r||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=s.NoIframeSrc,e}})(n),r=(e=>{if(e&&h.find((n=>e.startsWith(n))))return"null";const n=document.location,t=d.exec(e);let r,o,i;return t?(r=t[1]?t[1]:n.protocol,o=t[2],i=t[4]):(r=n.protocol,o=n.hostname,i=n.port),`${r}//${o}${i&&i!==u[r]?`:${i}`:""}`})(n.src));const v="null"===r?"*":r,g=((e,n,t,r)=>i=>{if(i.origin!==t)return void e(`Parent: Handshake - Received SYN message from origin ${i.origin} which did not match expected origin ${t}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:o.SynAck,methodNames:Object.keys(n)};i.source.postMessage(s,r)})(l,t,r,v),y=w(t,r,v,f,l);return{promise:new Promise(((e,t)=>{const r=((e,n)=>{let t;return void 0!==e&&(t=window.setTimeout((()=>{const t=new Error(`Connection timed out after ${e}ms`);t.code=s.ConnectionTimeout,n(t)}),e)),()=>{clearTimeout(t)}})(i,p),a=t=>{if(t.source===n.contentWindow&&t.data)if(t.data.penpal!==o.Syn)if(t.data.penpal!==o.Ack);else{const n=y(t);n&&(r(),e(n))}else g(t)};window.addEventListener(c.Message,a),l("Parent: Awaiting handshake"),((e,n)=>{const{destroy:t,onDestroy:r}=n,o=setInterval((()=>{e.isConnected||(clearInterval(o),t())}),6e4);r((()=>{clearInterval(o)}))})(n,f),m((e=>{window.removeEventListener(c.Message,a),e||((e=new Error("Connection destroyed")).code=s.ConnectionDestroyed),t(e)}))})),destroy(){p()}}},y=function(e){return void 0===e.value&&void 0===e.info&&void 0===e.selectOptions&&void 0===e.manyToOne},k=function(n){var t=e({},n);return t.validators&&(t.validators=t.validators.map((function(n){return("regex_match"===n.validate||"regex_exclude"===n.validate)&&n.regex instanceof RegExp?e(e({},n),{regex:n.regex.source,regexOptions:{ignoreCase:n.regex.flags.includes("i"),dotAll:n.regex.flags.includes("s"),multiline:n.regex.flags.includes("m"),unicode:n.regex.flags.includes("u")}}):n}))),t},b=function(e){return setTimeout((function(){console.warn("[Dromo Error] Slow ".concat(e," detected (>10s). Long running hooks can degrade user experience and importer performance."))}),1e4)},E=function(e){clearTimeout(e)};return function(){function r(r,o,i,s){var a=this;this.columnHooks=[],this.bulkRowHooks=[],this.rowHooks=[],this.stepHooks=[],this.rowDeleteHooks=[],this.initChild=function(){return n(a,void 0,void 0,(function(){var n,r,o,i,s;return t(this,(function(t){switch(t.label){case 0:return this.connection?[4,this.connection.promise]:(console.error("shim cannot connect with Dromo service."),alert("There was en error opening the importer. Please contact support if this issue persists."),[2]);case 1:return n=t.sent(),r=Array.from(document.getElementsByTagName("script")).some((function(e){return"https://unpkg.com/dromo-uploader-js/dist/DromoUploader.js"===e.src||"https://cdn.jsdelivr.net/npm/dromo-uploader-js@latest/dist/DromoUploader.js"===e.src})),[4,n.setNumRegisteredRowHooks(this.totalNumRowHooks())];case 2:return t.sent(),[4,n.setNumRegisteredColHooks(this.columnHooks.length)];case 3:return t.sent(),[4,n.setNumRegisteredRowDeleteHooks(this.rowDeleteHooks.length)];case 4:return t.sent(),this.fields&&this.settings&&this.user?(o=e({},this.settings),r||(o.version=null!==(i=o.version)&&void 0!==i?i:"v2"),o.browserExcelParsing=null===(s=o.browserExcelParsing)||void 0===s||s,[4,n.init(this.licenseKey,this.fields,o,this.user,this.appHost)]):[3,6];case 5:return t.sent(),[3,9];case 6:return this.schemaId?[4,n.initFromSavedSchema(this.licenseKey,this.schemaId,this.appHost,{user:this.user,developmentMode:this.developmentMode,headerRowOverride:this.headerRowOverride})]:[3,8];case 7:return t.sent(),[3,9];case 8:console.error("Invalid Dromo configuration"),t.label=9;case 9:return[2]}}))}))},this.initIFrame=function(){var e,n,t;if(!document.getElementById(a.iframeId)){var r=l;if(null===(e=a.settings)||void 0===e?void 0:e.alternateDomain){var o=new URL(a.settings.alternateDomain);r=o.protocol+"//widget."+o.host}var i=document.createElement("iframe"),s=null!==(t=null===(n=a.settings)||void 0===n?void 0:n.importIdentifier)&&void 0!==t?t:a.schemaId;i.title=s?"Dromo Importer: ".concat(s):"Dromo Importer",i.src=window.DROMO_WIDGET_OVERRIDE||r,i.id=a.iframeId,i.style.height="100%",i.style.width="100%",i.style.border="0",i.crossorigin="anonymous",a.iframe=i}},this.createConnection=function(){var r=a,o=a.iframe;o?a.connection=g({iframe:o,methods:{handleColumnHooks:function(o,i){return n(this,void 0,void 0,(function(){var s,a,c,l,u=this;return t(this,(function(d){switch(d.label){case 0:return s=r.columnHooks.filter((function(e){return e.fieldName===o})),a=new Map,c=i,[4,s.reduce((function(e,r){return n(u,void 0,void 0,(function(){var o=this;return t(this,(function(i){switch(i.label){case 0:return[4,e.then((function(){return n(o,void 0,void 0,(function(){var e,n,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=b("column hook"),[4,r.callback(c)];case 1:return n=t.sent(),E(e),n.forEach((function(e){if(void 0!==e.value||void 0!==e.info){var n={};void 0!==e.value&&(n.value=e.value,c[e.index]=e.value),void 0!==e.info&&(n.info=e.info),a.set(e.index,n)}})),[3,3];case 2:return o=t.sent(),console.error("[Dromo-External-Error] There was an error running your col hook.",o),[3,3];case 3:return[2]}}))}))}))];case 1:return i.sent(),[2]}}))}))}),Promise.resolve())];case 1:return d.sent(),l=[],a.forEach((function(n,t){return l.push(e(e({},n),{index:t}))})),[2,l]}}))}))},handleRowHooks:function(e,o){return n(this,void 0,void 0,(function(){var i,s,a,c,l,u,d,h,f,m,p,v,w,g=this;return t(this,(function(k){switch(k.label){case 0:i=new Map,s=new Map(e.map((function(e){return[e.index,e]}))),a=function(e,n){for(var t,r=s.get(e),o=function(n,o){if(y(o))return"continue";var s=r.row[n],a=Array.isArray(s.manyToOne),c="manyToOne"in o&&Array.isArray(o.manyToOne);if(a&&!c)throw new Error("".concat(n," should have manyToOne defined as an array."));if(a&&c&&s.manyToOne.length!==o.manyToOne.length)throw new Error("".concat(n," should be array of length ").concat(s.manyToOne.length));var l=i.get(e)||{},u=null!==(t=l[n])&&void 0!==t?t:{},d=[];c?(u.manyToOne=[],o.manyToOne.forEach((function(e,n){if(!y(e)){var t={};u.manyToOne.push(t),d.push({fieldOutput:e,rowDataField:s.manyToOne[n],cellChange:t})}}))):d.push({fieldOutput:o,rowDataField:s,cellChange:u}),d.forEach((function(e){var n=e.fieldOutput,t=e.rowDataField,r=e.cellChange;void 0!==n.value&&(r.value=n.value,t.value=n.value),void 0!==n.info&&(r.info=n.info,t.info=n.info),void 0!==n.selectOptions&&(r.selectOptions=n.selectOptions,t.selectOptions=n.selectOptions)})),l[n]=u,i.set(e,l)},a=0,c=Object.entries(null!=n?n:{});a<c.length;a++){var l=c[a];o(l[0],l[1])}},c=0,l=r.bulkRowHooks,k.label=1;case 1:if(!(c<l.length))return[3,6];u=l[c],k.label=2;case 2:return k.trys.push([2,4,,5]),d=b("bulk row hook"),[4,u(e,o)];case 3:for(h=k.sent(),E(d),f=0,m=h;f<m.length;f++)p=m[f],a(p.index,p.row);return[3,5];case 4:return v=k.sent(),console.error("[Dromo-External-Error] There was an error running your bulk row hook.",v),[3,5];case 5:return c++,[3,1];case 6:return[4,Promise.all(e.map((function(e){return n(g,void 0,void 0,(function(){var n,i,s,c,l,u;return t(this,(function(t){switch(t.label){case 0:n=0,i=r.rowHooks,t.label=1;case 1:if(!(n<i.length))return[3,6];s=i[n],t.label=2;case 2:return t.trys.push([2,4,,5]),c=b("row hook"),[4,s.callback(e,o)];case 3:return l=t.sent(),E(c),a(e.index,l.row),[3,5];case 4:return u=t.sent(),console.error("[Dromo-External-Error] There was an error running your row hook.",u),[3,5];case 5:return n++,[3,1];case 6:return[2]}}))}))})))];case 7:return k.sent(),w=[],i.forEach((function(e,n){w.push({index:n,row:e})})),[2,w]}}))}))},handleStepHook:function(e,n){r.stepHooks.forEach((function(t){if(e===t.type)try{t.callback(r,n)}catch(e){console.error("[Dromo-External-Error] There was an error in your step callback.",e)}}))},handleRowDeleteHooks:function(e){var o=this;return Promise.all(e.map((function(e){return n(o,void 0,void 0,(function(){var o=this;return t(this,(function(i){switch(i.label){case 0:return[4,r.rowDeleteHooks.forEach((function(r){return n(o,void 0,void 0,(function(){var n,o;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n=b("row delete hook"),[4,r(e)];case 1:return t.sent(),E(n),[3,3];case 2:return o=t.sent(),console.error("[Dromo-External-Error] There was an error running your row delete hook.",o),[3,3];case 3:return[2]}}))}))}))];case 1:return i.sent(),[2]}}))}))})))},handleBeforeFinishCallback:function(e,o){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:if(!r.beforeFinishCallback)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,r.beforeFinishCallback(e,o,r)];case 2:return[2,t.sent()];case 3:return n=t.sent(),console.error("[Dromo-External-Error] There was an error in your beforeFinish callback.",n),[3,4];case 4:return[2]}}))}))},handleResults:function(e,o){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:if(!r.resultsCallback)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,r.resultsCallback(e,o)];case 2:return t.sent(),[3,4];case 3:return n=t.sent(),console.error("[Dromo-External-Error] There was an error in your onResult callback.",n),[3,4];case 4:return r.close(),[2]}}))}))},handleCloseModal:function(){r.close()},handleCancel:function(){if(r.cancelCallback)try{r.cancelCallback()}catch(e){console.error("[Dromo-External-Error] There was an error in your cancel callback.",e)}r.close()}}}):console.error("shim cannot connect to Dromo.")},this.mountIFrame=function(){if(!document.getElementById(a.iframeId)){var e=document.createElement("div");e.id=a.wrapperId,e.style.zIndex=Number.MAX_SAFE_INTEGER.toString(),e.style.visibility="hidden",e.style.width="0px",e.style.height="0px",e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.right="0px",e.style.bottom="0px",e.appendChild(a.iframe),document.body.appendChild(e),a.wrapper=e}},this.showIFrame=function(){a.wrapper&&(a.wrapper.style.visibility="visible",a.wrapper.style.width="100%",a.wrapper.style.height="100%",document.body.style.overflow="hidden")},this.registerColumnHook=function(e,n){a.columnHooks.push({fieldName:e,callback:n}),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredColHooks(a.columnHooks.length)}))},this.totalNumRowHooks=function(){return a.rowHooks.length+a.bulkRowHooks.length},this.registerBulkRowHook=function(e){a.bulkRowHooks.push(e),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowHooks(a.totalNumRowHooks())}))},this.registerRowHook=function(e){a.rowHooks.push({callback:e}),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowHooks(a.totalNumRowHooks())}))},this.registerStepHook=function(e,n){a.stepHooks.push({type:e,callback:n})},this.registerRowDeleteHook=function(e){a.rowDeleteHooks.push(e),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowDeleteHooks(a.rowDeleteHooks.length)}))},this.beforeFinish=function(e){a.beforeFinishCallback=e},this.registerAllHooks=function(e){if(e.columnHooks)for(var n=0,t=e.columnHooks;n<t.length;n++){var r=t[n],o=r.fieldName,i=r.callback;a.registerColumnHook(o,i)}if(e.rowHooks)for(var s=0,c=e.rowHooks;s<c.length;s++){var l=c[s];a.registerRowHook(l)}if(e.bulkRowHooks)for(var u=0,d=e.bulkRowHooks;u<d.length;u++){var h=d[u];a.registerBulkRowHook(h)}if(e.rowDeleteHooks)for(var f=0,m=e.rowDeleteHooks;f<m.length;f++){var p=m[f];a.registerRowDeleteHook(p)}if(e.stepHooks)for(var v=0,w=e.stepHooks;v<w.length;v++){var g=w[v],y=g.type;i=g.callback;a.registerStepHook(y,i)}e.beforeFinishCallback&&a.beforeFinish(e.beforeFinishCallback)},this.onResults=function(e){a.resultsCallback=e},this.onCancel=function(e){a.cancelCallback=e},this.setUser=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.user=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setUser(this.user)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.addField=function(e,r){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().addField(k(e),r)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.removeField=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().removeField(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.updateInfoMessages=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().updateInfoMessages(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.setHeaderRowOverride=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.headerRowOverride=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setHeaderRowOverride(e)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.open=function(){return n(a,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.wrapper||(this.initIFrame(),this.createConnection(),this.mountIFrame()),[4,this.initChild()];case 1:return e.sent(),this.showIFrame(),[2]}}))}))},this.addRows=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().addRows(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.removeRows=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().removeRows(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.close=function(){a.wrapper&&(a.wrapper.style.visibility="hidden",a.wrapper.style.width="0px",a.wrapper.style.height="0px",document.body.style.overflow="inherit")},this.setDevelopmentMode=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.developmentMode=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setDevelopmentMode(this.developmentMode)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.rehydrate=function(e,r){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.wrapper||(this.initIFrame(),this.createConnection(),this.mountIFrame()),[4,this.initChild()];case 1:return n.sent(),[4,this.connection.promise];case 2:return[4,n.sent().rehydrate(e,r)];case 3:return n.sent(),this.showIFrame(),[2]}}))}))},this.iframeId=Math.random().toString(36).substring(7)+"-dromo-iframe-element",this.wrapperId=Math.random().toString(36).substring(7)+"-dromo-container",this.appHost=document.location.hostname,void 0!==i&&void 0!==s?(this.licenseKey=r,this.fields=o.map(k),this.settings=i,this.user=s,this.checkCloneable({licenseKey:this.licenseKey,fields:this.fields,settings:this.settings,user:this.user})):(this.licenseKey=r,this.schemaId=o,this.checkCloneable({licenseKey:this.licenseKey,schemaId:this.schemaId}))}var o;return r.prototype.checkCloneable=function(e){if("function"==typeof structuredClone){var n=Object.entries(e).filter((function(e){e[0];var n=e[1];try{return structuredClone(n),!1}catch(e){return!0}})).map((function(e){return e[0]}));if(n.length>0){var t=n.join(", ");throw new Error("[Dromo-External-Error] The Dromo importer received non-cloneable parameters: ".concat(t,". See https://dromo.dev/err/clone"))}}},o=r,r.rehydrateHeadless=function(e){var i=e.licenseKey,s=e.headlessImportId,a=e.fields,c=e.settings,l=e.hooks,u=e.rehydrateState;return n(void 0,void 0,void 0,(function(){var e;return t(o,(function(n){switch(n.label){case 0:return(e=new r(i,a,c,{id:"headless-review"})).registerAllHooks(l),[4,e.rehydrate(u,s)];case 1:return n.sent(),e.open(),[2,e]}}))}))},r}()}();
***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)};function n(e,n,t,o){return new(t||(t=Promise))((function(r,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,a)}c((o=o.apply(e,n||[])).next())}))}function t(e,n){var t,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=n.call(e,s)}catch(e){i=[6,e],o=0}finally{t=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var o,r,i,s,a,c,l={IFRAME_URL:"https://widget.dromo.io/"}.IFRAME_URL;!function(e){e.INIT_IFRAME="INIT_IFRAME"}(o||(o={})),function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(r||(r={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(i||(i={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NotInIframe="NotInIframe",e.NoIframeSrc="NoIframeSrc"}(s||(s={})),function(e){e.DataCloneError="DataCloneError"}(a||(a={})),function(e){e.Message="message"}(c||(c={}));const u={"http:":"80","https:":"443"},d=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,h=["file:","data:"];const f=({name:e,message:n,stack:t})=>({name:e,message:n,stack:t});let m=0;var p=()=>++m,v=(e,n,t,o,a)=>{const{localName:l,local:u,remote:d,originForSending:h,originForReceiving:f}=n;let m=!1;a(`${l}: Connecting call sender`);const v=e=>(...n)=>{let t;a(`${l}: Sending ${e}() call`);try{d.closed&&(t=!0)}catch(e){t=!0}if(t&&o(),m){const n=new Error(`Unable to send ${e}() call due to destroyed connection`);throw n.code=s.ConnectionDestroyed,n}return new Promise(((t,o)=>{const s=p(),m=n=>{if(n.source!==d||n.data.penpal!==r.Reply||n.data.id!==s)return;if(n.origin!==f)return void a(`${l} received message from origin ${n.origin} which did not match expected origin ${f}`);const h=n.data;a(`${l}: Received ${e}() reply`),u.removeEventListener(c.Message,m);let p=h.returnValue;h.returnValueIsError&&(p=(e=>{const n=new Error;return Object.keys(e).forEach((t=>n[t]=e[t])),n})(p)),(h.resolution===i.Fulfilled?t:o)(p)};u.addEventListener(c.Message,m);const v={penpal:r.Call,id:s,methodName:e,args:n};d.postMessage(v,h)}))};return t.reduce(((e,n)=>(e[n]=v(n),e)),e),()=>{m=!0}},w=(e,n,t,o,s)=>{const{destroy:l,onDestroy:u}=o;let d,h;const m={};return o=>{if(o.origin!==n)return void s(`Parent: Handshake - Received ACK message from origin ${o.origin} which did not match expected origin ${n}`);s("Parent: Handshake - Received ACK");const p={localName:"Parent",local:window,remote:o.source,originForSending:t,originForReceiving:n};d&&d(),d=((e,n,t)=>{const{localName:o,local:s,remote:l,originForSending:u,originForReceiving:d}=e;let h=!1;const m=e=>{if(e.source!==l||e.data.penpal!==r.Call)return;if(e.origin!==d)return void t(`${o} received message from origin ${e.origin} which did not match expected origin ${d}`);const s=e.data,{methodName:c,args:m,id:p}=s;t(`${o}: Received ${c}() call`);const v=e=>n=>{if(t(`${o}: Sending ${c}() reply`),h)return void t(`${o}: Unable to send ${c}() reply due to destroyed connection`);const s={penpal:r.Reply,id:p,resolution:e,returnValue:n};e===i.Rejected&&n instanceof Error&&(s.returnValue=f(n),s.returnValueIsError=!0);try{l.postMessage(s,u)}catch(e){if(e.name===a.DataCloneError){const n={penpal:r.Reply,id:p,resolution:i.Rejected,returnValue:f(e),returnValueIsError:!0};l.postMessage(n,u)}throw e}};new Promise((e=>e(n[c].apply(n,m)))).then(v(i.Fulfilled),v(i.Rejected))};return s.addEventListener(c.Message,m),()=>{h=!0,s.removeEventListener(c.Message,m)}})(p,e,s),u(d),h&&h.forEach((e=>{delete m[e]})),h=o.data.methodNames;const w=v(m,p,h,l,s);return u(w),m}};var g=e=>{let{iframe:n,methods:t={},childOrigin:o,timeout:i,debug:a=!1}=e;const l=(e=>(...n)=>{e&&console.log("[Penpal]",...n)})(a),f=(()=>{const e=[];let n=!1;return{destroy(t){n=!0,e.forEach((e=>{e(t)}))},onDestroy(t){n?t():e.push(t)}}})(),{onDestroy:m,destroy:p}=f;o||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=s.NoIframeSrc,e}})(n),o=(e=>{if(e&&h.find((n=>e.startsWith(n))))return"null";const n=document.location,t=d.exec(e);let o,r,i;return t?(o=t[1]?t[1]:n.protocol,r=t[2],i=t[4]):(o=n.protocol,r=n.hostname,i=n.port),`${o}//${r}${i&&i!==u[o]?`:${i}`:""}`})(n.src));const v="null"===o?"*":o,g=((e,n,t,o)=>i=>{if(i.origin!==t)return void e(`Parent: Handshake - Received SYN message from origin ${i.origin} which did not match expected origin ${t}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:r.SynAck,methodNames:Object.keys(n)};i.source.postMessage(s,o)})(l,t,o,v),y=w(t,o,v,f,l);return{promise:new Promise(((e,t)=>{const o=((e,n)=>{let t;return void 0!==e&&(t=window.setTimeout((()=>{const t=new Error(`Connection timed out after ${e}ms`);t.code=s.ConnectionTimeout,n(t)}),e)),()=>{clearTimeout(t)}})(i,p),a=t=>{if(t.source===n.contentWindow&&t.data)if(t.data.penpal!==r.Syn)if(t.data.penpal!==r.Ack);else{const n=y(t);n&&(o(),e(n))}else g(t)};window.addEventListener(c.Message,a),l("Parent: Awaiting handshake"),((e,n)=>{const{destroy:t,onDestroy:o}=n,r=setInterval((()=>{e.isConnected||(clearInterval(r),t())}),6e4);o((()=>{clearInterval(r)}))})(n,f),m((e=>{window.removeEventListener(c.Message,a),e||((e=new Error("Connection destroyed")).code=s.ConnectionDestroyed),t(e)}))})),destroy(){p()}}},y=function(e){return void 0===e.value&&void 0===e.info&&void 0===e.selectOptions&&void 0===e.manyToOne},k=function(n){var t=e({},n);return t.validators&&(t.validators=t.validators.map((function(n){return("regex_match"===n.validate||"regex_exclude"===n.validate)&&n.regex instanceof RegExp?e(e({},n),{regex:n.regex.source,regexOptions:{ignoreCase:n.regex.flags.includes("i"),dotAll:n.regex.flags.includes("s"),multiline:n.regex.flags.includes("m"),unicode:n.regex.flags.includes("u")}}):n}))),t},b=function(e){return setTimeout((function(){console.warn("[Dromo Error] Slow ".concat(e," detected (>10s). Long running hooks can degrade user experience and importer performance."))}),1e4)},E=function(e){clearTimeout(e)};return function(){function o(o,r,i,s){var a=this;this.columnHooks=[],this.bulkRowHooks=[],this.rowHooks=[],this.stepHooks=[],this.rowDeleteHooks=[],this.initChild=function(){return n(a,void 0,void 0,(function(){var n,o,r,i,s;return t(this,(function(t){switch(t.label){case 0:return this.connection?[4,this.connection.promise]:(console.error("shim cannot connect with Dromo service."),alert("There was en error opening the importer. Please contact support if this issue persists."),[2]);case 1:return n=t.sent(),o=Array.from(document.getElementsByTagName("script")).some((function(e){return"https://unpkg.com/dromo-uploader-js/dist/DromoUploader.js"===e.src||"https://cdn.jsdelivr.net/npm/dromo-uploader-js@latest/dist/DromoUploader.js"===e.src})),[4,n.setNumRegisteredRowHooks(this.totalNumRowHooks())];case 2:return t.sent(),[4,n.setNumRegisteredColHooks(this.columnHooks.length)];case 3:return t.sent(),[4,n.setNumRegisteredRowDeleteHooks(this.rowDeleteHooks.length)];case 4:return t.sent(),this.fields&&this.settings&&this.user?(r=e({},this.settings),o||(r.version=null!==(i=r.version)&&void 0!==i?i:"v2"),r.browserExcelParsing=null===(s=r.browserExcelParsing)||void 0===s||s,[4,n.init(this.licenseKey,this.fields,r,this.user,this.appHost)]):[3,6];case 5:return t.sent(),[3,9];case 6:return this.schemaId?[4,n.initFromSavedSchema(this.licenseKey,this.schemaId,this.appHost,{user:this.user,developmentMode:this.developmentMode,headerRowOverride:this.headerRowOverride})]:[3,8];case 7:return t.sent(),[3,9];case 8:console.error("Invalid Dromo configuration"),t.label=9;case 9:return[2]}}))}))},this.initIFrame=function(){var e,n,t,o,r;if(window.DROMO_WIDGET_OVERRIDE)r=window.DROMO_WIDGET_OVERRIDE;else if(null===(e=a.settings)||void 0===e?void 0:e.alternateDomain){var i=new URL(a.settings.alternateDomain);r=i.protocol+"//widget."+i.host}else r="v1"===(null===(n=a.settings)||void 0===n?void 0:n.version)?"https://widget-v1.dromo.io/":l;if(!document.getElementById(a.iframeId)){var s=document.createElement("iframe"),c=null!==(o=null===(t=a.settings)||void 0===t?void 0:t.importIdentifier)&&void 0!==o?o:a.schemaId;s.title=c?"Dromo Importer: ".concat(c):"Dromo Importer",s.src=r,s.id=a.iframeId,s.style.height="100%",s.style.width="100%",s.style.border="0",s.crossorigin="anonymous",a.iframe=s}},this.createConnection=function(){var o=a,r=a.iframe;r?a.connection=g({iframe:r,methods:{handleColumnHooks:function(r,i){return n(this,void 0,void 0,(function(){var s,a,c,l,u=this;return t(this,(function(d){switch(d.label){case 0:return s=o.columnHooks.filter((function(e){return e.fieldName===r})),a=new Map,c=i,[4,s.reduce((function(e,o){return n(u,void 0,void 0,(function(){var r=this;return t(this,(function(i){switch(i.label){case 0:return[4,e.then((function(){return n(r,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=b("column hook"),[4,o.callback(c)];case 1:return n=t.sent(),E(e),n.forEach((function(e){if(void 0!==e.value||void 0!==e.info){var n={};void 0!==e.value&&(n.value=e.value,c[e.index]=e.value),void 0!==e.info&&(n.info=e.info),a.set(e.index,n)}})),[3,3];case 2:return r=t.sent(),console.error("[Dromo-External-Error] There was an error running your col hook.",r),[3,3];case 3:return[2]}}))}))}))];case 1:return i.sent(),[2]}}))}))}),Promise.resolve())];case 1:return d.sent(),l=[],a.forEach((function(n,t){return l.push(e(e({},n),{index:t}))})),[2,l]}}))}))},handleRowHooks:function(e,r){return n(this,void 0,void 0,(function(){var i,s,a,c,l,u,d,h,f,m,p,v,w,g=this;return t(this,(function(k){switch(k.label){case 0:i=new Map,s=new Map(e.map((function(e){return[e.index,e]}))),a=function(e,n){for(var t,o=s.get(e),r=function(n,r){if(y(r))return"continue";var s=o.row[n],a=Array.isArray(s.manyToOne),c="manyToOne"in r&&Array.isArray(r.manyToOne);if(a&&!c)throw new Error("".concat(n," should have manyToOne defined as an array."));if(a&&c&&s.manyToOne.length!==r.manyToOne.length)throw new Error("".concat(n," should be array of length ").concat(s.manyToOne.length));var l=i.get(e)||{},u=null!==(t=l[n])&&void 0!==t?t:{},d=[];c?(u.manyToOne=[],r.manyToOne.forEach((function(e,n){if(!y(e)){var t={};u.manyToOne.push(t),d.push({fieldOutput:e,rowDataField:s.manyToOne[n],cellChange:t})}}))):d.push({fieldOutput:r,rowDataField:s,cellChange:u}),d.forEach((function(e){var n=e.fieldOutput,t=e.rowDataField,o=e.cellChange;void 0!==n.value&&(o.value=n.value,t.value=n.value),void 0!==n.info&&(o.info=n.info,t.info=n.info),void 0!==n.selectOptions&&(o.selectOptions=n.selectOptions,t.selectOptions=n.selectOptions)})),l[n]=u,i.set(e,l)},a=0,c=Object.entries(null!=n?n:{});a<c.length;a++){var l=c[a];r(l[0],l[1])}},c=0,l=o.bulkRowHooks,k.label=1;case 1:if(!(c<l.length))return[3,6];u=l[c],k.label=2;case 2:return k.trys.push([2,4,,5]),d=b("bulk row hook"),[4,u(e,r)];case 3:for(h=k.sent(),E(d),f=0,m=h;f<m.length;f++)p=m[f],a(p.index,p.row);return[3,5];case 4:return v=k.sent(),console.error("[Dromo-External-Error] There was an error running your bulk row hook.",v),[3,5];case 5:return c++,[3,1];case 6:return[4,Promise.all(e.map((function(e){return n(g,void 0,void 0,(function(){var n,i,s,c,l,u;return t(this,(function(t){switch(t.label){case 0:n=0,i=o.rowHooks,t.label=1;case 1:if(!(n<i.length))return[3,6];s=i[n],t.label=2;case 2:return t.trys.push([2,4,,5]),c=b("row hook"),[4,s.callback(e,r)];case 3:return l=t.sent(),E(c),a(e.index,l.row),[3,5];case 4:return u=t.sent(),console.error("[Dromo-External-Error] There was an error running your row hook.",u),[3,5];case 5:return n++,[3,1];case 6:return[2]}}))}))})))];case 7:return k.sent(),w=[],i.forEach((function(e,n){w.push({index:n,row:e})})),[2,w]}}))}))},handleStepHook:function(e,n){o.stepHooks.forEach((function(t){if(e===t.type)try{t.callback(o,n)}catch(e){console.error("[Dromo-External-Error] There was an error in your step callback.",e)}}))},handleRowDeleteHooks:function(e){var r=this;return Promise.all(e.map((function(e){return n(r,void 0,void 0,(function(){var r=this;return t(this,(function(i){switch(i.label){case 0:return[4,o.rowDeleteHooks.forEach((function(o){return n(r,void 0,void 0,(function(){var n,r;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n=b("row delete hook"),[4,o(e)];case 1:return t.sent(),E(n),[3,3];case 2:return r=t.sent(),console.error("[Dromo-External-Error] There was an error running your row delete hook.",r),[3,3];case 3:return[2]}}))}))}))];case 1:return i.sent(),[2]}}))}))})))},handleBeforeFinishCallback:function(e,r){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:if(!o.beforeFinishCallback)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.beforeFinishCallback(e,r,o)];case 2:return[2,t.sent()];case 3:return n=t.sent(),console.error("[Dromo-External-Error] There was an error in your beforeFinish callback.",n),[3,4];case 4:return[2]}}))}))},handleResults:function(e,r){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:if(!o.resultsCallback)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.resultsCallback(e,r)];case 2:return t.sent(),[3,4];case 3:return n=t.sent(),console.error("[Dromo-External-Error] There was an error in your onResult callback.",n),[3,4];case 4:return o.close(),[2]}}))}))},handleCloseModal:function(){o.close()},handleCancel:function(){if(o.cancelCallback)try{o.cancelCallback()}catch(e){console.error("[Dromo-External-Error] There was an error in your cancel callback.",e)}o.close()}}}):console.error("shim cannot connect to Dromo.")},this.mountIFrame=function(){if(!document.getElementById(a.iframeId)){var e=document.createElement("div");e.id=a.wrapperId,e.style.zIndex=Number.MAX_SAFE_INTEGER.toString(),e.style.visibility="hidden",e.style.width="0px",e.style.height="0px",e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.right="0px",e.style.bottom="0px",e.appendChild(a.iframe),document.body.appendChild(e),a.wrapper=e}},this.showIFrame=function(){a.wrapper&&(a.wrapper.style.visibility="visible",a.wrapper.style.width="100%",a.wrapper.style.height="100%",document.body.style.overflow="hidden")},this.registerColumnHook=function(e,n){a.columnHooks.push({fieldName:e,callback:n}),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredColHooks(a.columnHooks.length)}))},this.totalNumRowHooks=function(){return a.rowHooks.length+a.bulkRowHooks.length},this.registerBulkRowHook=function(e){a.bulkRowHooks.push(e),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowHooks(a.totalNumRowHooks())}))},this.registerRowHook=function(e){a.rowHooks.push({callback:e}),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowHooks(a.totalNumRowHooks())}))},this.registerStepHook=function(e,n){a.stepHooks.push({type:e,callback:n})},this.registerRowDeleteHook=function(e){a.rowDeleteHooks.push(e),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowDeleteHooks(a.rowDeleteHooks.length)}))},this.beforeFinish=function(e){a.beforeFinishCallback=e},this.registerAllHooks=function(e){if(e.columnHooks)for(var n=0,t=e.columnHooks;n<t.length;n++){var o=t[n],r=o.fieldName,i=o.callback;a.registerColumnHook(r,i)}if(e.rowHooks)for(var s=0,c=e.rowHooks;s<c.length;s++){var l=c[s];a.registerRowHook(l)}if(e.bulkRowHooks)for(var u=0,d=e.bulkRowHooks;u<d.length;u++){var h=d[u];a.registerBulkRowHook(h)}if(e.rowDeleteHooks)for(var f=0,m=e.rowDeleteHooks;f<m.length;f++){var p=m[f];a.registerRowDeleteHook(p)}if(e.stepHooks)for(var v=0,w=e.stepHooks;v<w.length;v++){var g=w[v],y=g.type;i=g.callback;a.registerStepHook(y,i)}e.beforeFinishCallback&&a.beforeFinish(e.beforeFinishCallback)},this.onResults=function(e){a.resultsCallback=e},this.onCancel=function(e){a.cancelCallback=e},this.setUser=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.user=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setUser(this.user)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.addField=function(e,o){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().addField(k(e),o)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.removeField=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().removeField(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.updateInfoMessages=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().updateInfoMessages(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.setHeaderRowOverride=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.headerRowOverride=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setHeaderRowOverride(e)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.open=function(){return n(a,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.wrapper||(this.initIFrame(),this.createConnection(),this.mountIFrame()),[4,this.initChild()];case 1:return e.sent(),this.showIFrame(),[2]}}))}))},this.addRows=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().addRows(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.removeRows=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().removeRows(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.close=function(){a.wrapper&&(a.wrapper.style.visibility="hidden",a.wrapper.style.width="0px",a.wrapper.style.height="0px",document.body.style.overflow="inherit")},this.setDevelopmentMode=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.developmentMode=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setDevelopmentMode(this.developmentMode)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.rehydrate=function(e,o){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.wrapper||(this.initIFrame(),this.createConnection(),this.mountIFrame()),[4,this.initChild()];case 1:return n.sent(),[4,this.connection.promise];case 2:return[4,n.sent().rehydrate(e,o)];case 3:return n.sent(),this.showIFrame(),[2]}}))}))},this.iframeId=Math.random().toString(36).substring(7)+"-dromo-iframe-element",this.wrapperId=Math.random().toString(36).substring(7)+"-dromo-container",this.appHost=document.location.hostname,void 0!==i&&void 0!==s?(this.licenseKey=o,this.fields=r.map(k),this.settings=i,this.user=s,this.checkCloneable({licenseKey:this.licenseKey,fields:this.fields,settings:this.settings,user:this.user})):(this.licenseKey=o,this.schemaId=r,this.checkCloneable({licenseKey:this.licenseKey,schemaId:this.schemaId}))}var r;return o.prototype.checkCloneable=function(e){if("function"==typeof structuredClone){var n=Object.entries(e).filter((function(e){e[0];var n=e[1];try{return structuredClone(n),!1}catch(e){return!0}})).map((function(e){return e[0]}));if(n.length>0){var t=n.join(", ");throw new Error("[Dromo-External-Error] The Dromo importer received non-cloneable parameters: ".concat(t,". See https://dromo.dev/err/clone"))}}},r=o,o.rehydrateHeadless=function(e){var i=e.licenseKey,s=e.headlessImportId,a=e.fields,c=e.settings,l=e.hooks,u=e.rehydrateState;return n(void 0,void 0,void 0,(function(){var e;return t(r,(function(n){switch(n.label){case 0:return(e=new o(i,a,c,{id:"headless-review"})).registerAllHooks(l),[4,e.rehydrate(u,s)];case 1:return n.sent(),e.open(),[2,e]}}))}))},o}()}();
//# sourceMappingURL=DromoUploader.js.map

@@ -15,3 +15,3 @@ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).DromoUploader=n()}(this,(function(){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)};function n(e,n,t,o){return new(t||(t=Promise))((function(r,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,a)}c((o=o.apply(e,n||[])).next())}))}function t(e,n){var t,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=n.call(e,s)}catch(e){i=[6,e],o=0}finally{t=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var o,r,i,s,a,c,l={IFRAME_URL:"https://widget.dromo.io/"}.IFRAME_URL;!function(e){e.INIT_IFRAME="INIT_IFRAME"}(o||(o={})),function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(r||(r={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(i||(i={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NotInIframe="NotInIframe",e.NoIframeSrc="NoIframeSrc"}(s||(s={})),function(e){e.DataCloneError="DataCloneError"}(a||(a={})),function(e){e.Message="message"}(c||(c={}));const u={"http:":"80","https:":"443"},d=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,h=["file:","data:"];const f=({name:e,message:n,stack:t})=>({name:e,message:n,stack:t});let m=0;var p=()=>++m,v=(e,n,t,o,a)=>{const{localName:l,local:u,remote:d,originForSending:h,originForReceiving:f}=n;let m=!1;a(`${l}: Connecting call sender`);const v=e=>(...n)=>{let t;a(`${l}: Sending ${e}() call`);try{d.closed&&(t=!0)}catch(e){t=!0}if(t&&o(),m){const n=new Error(`Unable to send ${e}() call due to destroyed connection`);throw n.code=s.ConnectionDestroyed,n}return new Promise(((t,o)=>{const s=p(),m=n=>{if(n.source!==d||n.data.penpal!==r.Reply||n.data.id!==s)return;if(n.origin!==f)return void a(`${l} received message from origin ${n.origin} which did not match expected origin ${f}`);const h=n.data;a(`${l}: Received ${e}() reply`),u.removeEventListener(c.Message,m);let p=h.returnValue;h.returnValueIsError&&(p=(e=>{const n=new Error;return Object.keys(e).forEach((t=>n[t]=e[t])),n})(p)),(h.resolution===i.Fulfilled?t:o)(p)};u.addEventListener(c.Message,m);const v={penpal:r.Call,id:s,methodName:e,args:n};d.postMessage(v,h)}))};return t.reduce(((e,n)=>(e[n]=v(n),e)),e),()=>{m=!0}},w=(e,n,t,o,s)=>{const{destroy:l,onDestroy:u}=o;let d,h;const m={};return o=>{if(o.origin!==n)return void s(`Parent: Handshake - Received ACK message from origin ${o.origin} which did not match expected origin ${n}`);s("Parent: Handshake - Received ACK");const p={localName:"Parent",local:window,remote:o.source,originForSending:t,originForReceiving:n};d&&d(),d=((e,n,t)=>{const{localName:o,local:s,remote:l,originForSending:u,originForReceiving:d}=e;let h=!1;const m=e=>{if(e.source!==l||e.data.penpal!==r.Call)return;if(e.origin!==d)return void t(`${o} received message from origin ${e.origin} which did not match expected origin ${d}`);const s=e.data,{methodName:c,args:m,id:p}=s;t(`${o}: Received ${c}() call`);const v=e=>n=>{if(t(`${o}: Sending ${c}() reply`),h)return void t(`${o}: Unable to send ${c}() reply due to destroyed connection`);const s={penpal:r.Reply,id:p,resolution:e,returnValue:n};e===i.Rejected&&n instanceof Error&&(s.returnValue=f(n),s.returnValueIsError=!0);try{l.postMessage(s,u)}catch(e){if(e.name===a.DataCloneError){const n={penpal:r.Reply,id:p,resolution:i.Rejected,returnValue:f(e),returnValueIsError:!0};l.postMessage(n,u)}throw e}};new Promise((e=>e(n[c].apply(n,m)))).then(v(i.Fulfilled),v(i.Rejected))};return s.addEventListener(c.Message,m),()=>{h=!0,s.removeEventListener(c.Message,m)}})(p,e,s),u(d),h&&h.forEach((e=>{delete m[e]})),h=o.data.methodNames;const w=v(m,p,h,l,s);return u(w),m}};var g=e=>{let{iframe:n,methods:t={},childOrigin:o,timeout:i,debug:a=!1}=e;const l=(e=>(...n)=>{e&&console.log("[Penpal]",...n)})(a),f=(()=>{const e=[];let n=!1;return{destroy(t){n=!0,e.forEach((e=>{e(t)}))},onDestroy(t){n?t():e.push(t)}}})(),{onDestroy:m,destroy:p}=f;o||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=s.NoIframeSrc,e}})(n),o=(e=>{if(e&&h.find((n=>e.startsWith(n))))return"null";const n=document.location,t=d.exec(e);let o,r,i;return t?(o=t[1]?t[1]:n.protocol,r=t[2],i=t[4]):(o=n.protocol,r=n.hostname,i=n.port),`${o}//${r}${i&&i!==u[o]?`:${i}`:""}`})(n.src));const v="null"===o?"*":o,g=((e,n,t,o)=>i=>{if(i.origin!==t)return void e(`Parent: Handshake - Received SYN message from origin ${i.origin} which did not match expected origin ${t}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:r.SynAck,methodNames:Object.keys(n)};i.source.postMessage(s,o)})(l,t,o,v),y=w(t,o,v,f,l);return{promise:new Promise(((e,t)=>{const o=((e,n)=>{let t;return void 0!==e&&(t=window.setTimeout((()=>{const t=new Error(`Connection timed out after ${e}ms`);t.code=s.ConnectionTimeout,n(t)}),e)),()=>{clearTimeout(t)}})(i,p),a=t=>{if(t.source===n.contentWindow&&t.data)if(t.data.penpal!==r.Syn)if(t.data.penpal!==r.Ack);else{const n=y(t);n&&(o(),e(n))}else g(t)};window.addEventListener(c.Message,a),l("Parent: Awaiting handshake"),((e,n)=>{const{destroy:t,onDestroy:o}=n,r=setInterval((()=>{e.isConnected||(clearInterval(r),t())}),6e4);o((()=>{clearInterval(r)}))})(n,f),m((e=>{window.removeEventListener(c.Message,a),e||((e=new Error("Connection destroyed")).code=s.ConnectionDestroyed),t(e)}))})),destroy(){p()}}},y=function(e){return void 0===e.value&&void 0===e.info&&void 0===e.selectOptions&&void 0===e.manyToOne},k=function(n){var t=e({},n);return t.validators&&(t.validators=t.validators.map((function(n){return("regex_match"===n.validate||"regex_exclude"===n.validate)&&n.regex instanceof RegExp?e(e({},n),{regex:n.regex.source,regexOptions:{ignoreCase:n.regex.flags.includes("i"),dotAll:n.regex.flags.includes("s"),multiline:n.regex.flags.includes("m"),unicode:n.regex.flags.includes("u")}}):n}))),t},b=function(e){return setTimeout((function(){console.warn("[Dromo Error] Slow ".concat(e," detected (>10s). Long running hooks can degrade user experience and importer performance."))}),1e4)},E=function(e){clearTimeout(e)};return function(){function o(o,r,i,s){var a=this;this.columnHooks=[],this.bulkRowHooks=[],this.rowHooks=[],this.stepHooks=[],this.rowDeleteHooks=[],this.initChild=function(){return n(a,void 0,void 0,(function(){var n,o,r,i,s;return t(this,(function(t){switch(t.label){case 0:return this.connection?[4,this.connection.promise]:(console.error("shim cannot connect with Dromo service."),alert("There was en error opening the importer. Please contact support if this issue persists."),[2]);case 1:return n=t.sent(),o=Array.from(document.getElementsByTagName("script")).some((function(e){return"https://unpkg.com/dromo-uploader-js/dist/DromoUploader.js"===e.src||"https://cdn.jsdelivr.net/npm/dromo-uploader-js@latest/dist/DromoUploader.js"===e.src})),[4,n.setNumRegisteredRowHooks(this.totalNumRowHooks())];case 2:return t.sent(),[4,n.setNumRegisteredColHooks(this.columnHooks.length)];case 3:return t.sent(),[4,n.setNumRegisteredRowDeleteHooks(this.rowDeleteHooks.length)];case 4:return t.sent(),this.fields&&this.settings&&this.user?(r=e({},this.settings),o||(r.version=null!==(i=r.version)&&void 0!==i?i:"v2"),r.browserExcelParsing=null===(s=r.browserExcelParsing)||void 0===s||s,[4,n.init(this.licenseKey,this.fields,r,this.user,this.appHost)]):[3,6];case 5:return t.sent(),[3,9];case 6:return this.schemaId?[4,n.initFromSavedSchema(this.licenseKey,this.schemaId,this.appHost,{user:this.user,developmentMode:this.developmentMode,headerRowOverride:this.headerRowOverride})]:[3,8];case 7:return t.sent(),[3,9];case 8:console.error("Invalid Dromo configuration"),t.label=9;case 9:return[2]}}))}))},this.initIFrame=function(){var e,n,t;if(!document.getElementById(a.iframeId)){var o=l;if(null===(e=a.settings)||void 0===e?void 0:e.alternateDomain){var r=new URL(a.settings.alternateDomain);o=r.protocol+"//widget."+r.host}var i=document.createElement("iframe"),s=null!==(t=null===(n=a.settings)||void 0===n?void 0:n.importIdentifier)&&void 0!==t?t:a.schemaId;i.title=s?"Dromo Importer: ".concat(s):"Dromo Importer",i.src=window.DROMO_WIDGET_OVERRIDE||o,i.id=a.iframeId,i.style.height="100%",i.style.width="100%",i.style.border="0",i.crossorigin="anonymous",a.iframe=i}},this.createConnection=function(){var o=a,r=a.iframe;r?a.connection=g({iframe:r,methods:{handleColumnHooks:function(r,i){return n(this,void 0,void 0,(function(){var s,a,c,l,u=this;return t(this,(function(d){switch(d.label){case 0:return s=o.columnHooks.filter((function(e){return e.fieldName===r})),a=new Map,c=i,[4,s.reduce((function(e,o){return n(u,void 0,void 0,(function(){var r=this;return t(this,(function(i){switch(i.label){case 0:return[4,e.then((function(){return n(r,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=b("column hook"),[4,o.callback(c)];case 1:return n=t.sent(),E(e),n.forEach((function(e){if(void 0!==e.value||void 0!==e.info){var n={};void 0!==e.value&&(n.value=e.value,c[e.index]=e.value),void 0!==e.info&&(n.info=e.info),a.set(e.index,n)}})),[3,3];case 2:return r=t.sent(),console.error("[Dromo-External-Error] There was an error running your col hook.",r),[3,3];case 3:return[2]}}))}))}))];case 1:return i.sent(),[2]}}))}))}),Promise.resolve())];case 1:return d.sent(),l=[],a.forEach((function(n,t){return l.push(e(e({},n),{index:t}))})),[2,l]}}))}))},handleRowHooks:function(e,r){return n(this,void 0,void 0,(function(){var i,s,a,c,l,u,d,h,f,m,p,v,w,g=this;return t(this,(function(k){switch(k.label){case 0:i=new Map,s=new Map(e.map((function(e){return[e.index,e]}))),a=function(e,n){for(var t,o=s.get(e),r=function(n,r){if(y(r))return"continue";var s=o.row[n],a=Array.isArray(s.manyToOne),c="manyToOne"in r&&Array.isArray(r.manyToOne);if(a&&!c)throw new Error("".concat(n," should have manyToOne defined as an array."));if(a&&c&&s.manyToOne.length!==r.manyToOne.length)throw new Error("".concat(n," should be array of length ").concat(s.manyToOne.length));var l=i.get(e)||{},u=null!==(t=l[n])&&void 0!==t?t:{},d=[];c?(u.manyToOne=[],r.manyToOne.forEach((function(e,n){if(!y(e)){var t={};u.manyToOne.push(t),d.push({fieldOutput:e,rowDataField:s.manyToOne[n],cellChange:t})}}))):d.push({fieldOutput:r,rowDataField:s,cellChange:u}),d.forEach((function(e){var n=e.fieldOutput,t=e.rowDataField,o=e.cellChange;void 0!==n.value&&(o.value=n.value,t.value=n.value),void 0!==n.info&&(o.info=n.info,t.info=n.info),void 0!==n.selectOptions&&(o.selectOptions=n.selectOptions,t.selectOptions=n.selectOptions)})),l[n]=u,i.set(e,l)},a=0,c=Object.entries(null!=n?n:{});a<c.length;a++){var l=c[a];r(l[0],l[1])}},c=0,l=o.bulkRowHooks,k.label=1;case 1:if(!(c<l.length))return[3,6];u=l[c],k.label=2;case 2:return k.trys.push([2,4,,5]),d=b("bulk row hook"),[4,u(e,r)];case 3:for(h=k.sent(),E(d),f=0,m=h;f<m.length;f++)p=m[f],a(p.index,p.row);return[3,5];case 4:return v=k.sent(),console.error("[Dromo-External-Error] There was an error running your bulk row hook.",v),[3,5];case 5:return c++,[3,1];case 6:return[4,Promise.all(e.map((function(e){return n(g,void 0,void 0,(function(){var n,i,s,c,l,u;return t(this,(function(t){switch(t.label){case 0:n=0,i=o.rowHooks,t.label=1;case 1:if(!(n<i.length))return[3,6];s=i[n],t.label=2;case 2:return t.trys.push([2,4,,5]),c=b("row hook"),[4,s.callback(e,r)];case 3:return l=t.sent(),E(c),a(e.index,l.row),[3,5];case 4:return u=t.sent(),console.error("[Dromo-External-Error] There was an error running your row hook.",u),[3,5];case 5:return n++,[3,1];case 6:return[2]}}))}))})))];case 7:return k.sent(),w=[],i.forEach((function(e,n){w.push({index:n,row:e})})),[2,w]}}))}))},handleStepHook:function(e,n){o.stepHooks.forEach((function(t){if(e===t.type)try{t.callback(o,n)}catch(e){console.error("[Dromo-External-Error] There was an error in your step callback.",e)}}))},handleRowDeleteHooks:function(e){var r=this;return Promise.all(e.map((function(e){return n(r,void 0,void 0,(function(){var r=this;return t(this,(function(i){switch(i.label){case 0:return[4,o.rowDeleteHooks.forEach((function(o){return n(r,void 0,void 0,(function(){var n,r;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n=b("row delete hook"),[4,o(e)];case 1:return t.sent(),E(n),[3,3];case 2:return r=t.sent(),console.error("[Dromo-External-Error] There was an error running your row delete hook.",r),[3,3];case 3:return[2]}}))}))}))];case 1:return i.sent(),[2]}}))}))})))},handleBeforeFinishCallback:function(e,r){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:if(!o.beforeFinishCallback)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.beforeFinishCallback(e,r,o)];case 2:return[2,t.sent()];case 3:return n=t.sent(),console.error("[Dromo-External-Error] There was an error in your beforeFinish callback.",n),[3,4];case 4:return[2]}}))}))},handleResults:function(e,r){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:if(!o.resultsCallback)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.resultsCallback(e,r)];case 2:return t.sent(),[3,4];case 3:return n=t.sent(),console.error("[Dromo-External-Error] There was an error in your onResult callback.",n),[3,4];case 4:return o.close(),[2]}}))}))},handleCloseModal:function(){o.close()},handleCancel:function(){if(o.cancelCallback)try{o.cancelCallback()}catch(e){console.error("[Dromo-External-Error] There was an error in your cancel callback.",e)}o.close()}}}):console.error("shim cannot connect to Dromo.")},this.mountIFrame=function(){if(!document.getElementById(a.iframeId)){var e=document.createElement("div");e.id=a.wrapperId,e.style.zIndex=Number.MAX_SAFE_INTEGER.toString(),e.style.visibility="hidden",e.style.width="0px",e.style.height="0px",e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.right="0px",e.style.bottom="0px",e.appendChild(a.iframe),document.body.appendChild(e),a.wrapper=e}},this.showIFrame=function(){a.wrapper&&(a.wrapper.style.visibility="visible",a.wrapper.style.width="100%",a.wrapper.style.height="100%",document.body.style.overflow="hidden")},this.registerColumnHook=function(e,n){a.columnHooks.push({fieldName:e,callback:n}),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredColHooks(a.columnHooks.length)}))},this.totalNumRowHooks=function(){return a.rowHooks.length+a.bulkRowHooks.length},this.registerBulkRowHook=function(e){a.bulkRowHooks.push(e),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowHooks(a.totalNumRowHooks())}))},this.registerRowHook=function(e){a.rowHooks.push({callback:e}),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowHooks(a.totalNumRowHooks())}))},this.registerStepHook=function(e,n){a.stepHooks.push({type:e,callback:n})},this.registerRowDeleteHook=function(e){a.rowDeleteHooks.push(e),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowDeleteHooks(a.rowDeleteHooks.length)}))},this.beforeFinish=function(e){a.beforeFinishCallback=e},this.registerAllHooks=function(e){if(e.columnHooks)for(var n=0,t=e.columnHooks;n<t.length;n++){var o=t[n],r=o.fieldName,i=o.callback;a.registerColumnHook(r,i)}if(e.rowHooks)for(var s=0,c=e.rowHooks;s<c.length;s++){var l=c[s];a.registerRowHook(l)}if(e.bulkRowHooks)for(var u=0,d=e.bulkRowHooks;u<d.length;u++){var h=d[u];a.registerBulkRowHook(h)}if(e.rowDeleteHooks)for(var f=0,m=e.rowDeleteHooks;f<m.length;f++){var p=m[f];a.registerRowDeleteHook(p)}if(e.stepHooks)for(var v=0,w=e.stepHooks;v<w.length;v++){var g=w[v],y=g.type;i=g.callback;a.registerStepHook(y,i)}e.beforeFinishCallback&&a.beforeFinish(e.beforeFinishCallback)},this.onResults=function(e){a.resultsCallback=e},this.onCancel=function(e){a.cancelCallback=e},this.setUser=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.user=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setUser(this.user)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.addField=function(e,o){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().addField(k(e),o)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.removeField=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().removeField(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.updateInfoMessages=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().updateInfoMessages(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.setHeaderRowOverride=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.headerRowOverride=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setHeaderRowOverride(e)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.open=function(){return n(a,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.wrapper||(this.initIFrame(),this.createConnection(),this.mountIFrame()),[4,this.initChild()];case 1:return e.sent(),this.showIFrame(),[2]}}))}))},this.addRows=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().addRows(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.removeRows=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().removeRows(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.close=function(){a.wrapper&&(a.wrapper.style.visibility="hidden",a.wrapper.style.width="0px",a.wrapper.style.height="0px",document.body.style.overflow="inherit")},this.setDevelopmentMode=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.developmentMode=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setDevelopmentMode(this.developmentMode)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.rehydrate=function(e,o){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.wrapper||(this.initIFrame(),this.createConnection(),this.mountIFrame()),[4,this.initChild()];case 1:return n.sent(),[4,this.connection.promise];case 2:return[4,n.sent().rehydrate(e,o)];case 3:return n.sent(),this.showIFrame(),[2]}}))}))},this.iframeId=Math.random().toString(36).substring(7)+"-dromo-iframe-element",this.wrapperId=Math.random().toString(36).substring(7)+"-dromo-container",this.appHost=document.location.hostname,void 0!==i&&void 0!==s?(this.licenseKey=o,this.fields=r.map(k),this.settings=i,this.user=s,this.checkCloneable({licenseKey:this.licenseKey,fields:this.fields,settings:this.settings,user:this.user})):(this.licenseKey=o,this.schemaId=r,this.checkCloneable({licenseKey:this.licenseKey,schemaId:this.schemaId}))}var r;return o.prototype.checkCloneable=function(e){if("function"==typeof structuredClone){var n=Object.entries(e).filter((function(e){e[0];var n=e[1];try{return structuredClone(n),!1}catch(e){return!0}})).map((function(e){return e[0]}));if(n.length>0){var t=n.join(", ");throw new Error("[Dromo-External-Error] The Dromo importer received non-cloneable parameters: ".concat(t,". See https://dromo.dev/err/clone"))}}},r=o,o.rehydrateHeadless=function(e){var i=e.licenseKey,s=e.headlessImportId,a=e.fields,c=e.settings,l=e.hooks,u=e.rehydrateState;return n(void 0,void 0,void 0,(function(){var e;return t(r,(function(n){switch(n.label){case 0:return(e=new o(i,a,c,{id:"headless-review"})).registerAllHooks(l),[4,e.rehydrate(u,s)];case 1:return n.sent(),e.open(),[2,e]}}))}))},o}()}));
***************************************************************************** */var e=function(){return(e=Object.assign||function(e){for(var n,t=1,o=arguments.length;t<o;t++)for(var r in n=arguments[t])Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);return e}).apply(this,arguments)};function n(e,n,t,o){return new(t||(t=Promise))((function(r,i){function s(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?r(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(s,a)}c((o=o.apply(e,n||[])).next())}))}function t(e,n){var t,o,r,i,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(t)throw new TypeError("Generator is already executing.");for(;s;)try{if(t=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,o=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){s.label=i[1];break}if(6===i[0]&&s.label<r[1]){s.label=r[1],r=i;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(i);break}r[2]&&s.ops.pop(),s.trys.pop();continue}i=n.call(e,s)}catch(e){i=[6,e],o=0}finally{t=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}}var o,r,i,s,a,c,l={IFRAME_URL:"https://widget.dromo.io/"}.IFRAME_URL;!function(e){e.INIT_IFRAME="INIT_IFRAME"}(o||(o={})),function(e){e.Call="call",e.Reply="reply",e.Syn="syn",e.SynAck="synAck",e.Ack="ack"}(r||(r={})),function(e){e.Fulfilled="fulfilled",e.Rejected="rejected"}(i||(i={})),function(e){e.ConnectionDestroyed="ConnectionDestroyed",e.ConnectionTimeout="ConnectionTimeout",e.NotInIframe="NotInIframe",e.NoIframeSrc="NoIframeSrc"}(s||(s={})),function(e){e.DataCloneError="DataCloneError"}(a||(a={})),function(e){e.Message="message"}(c||(c={}));const u={"http:":"80","https:":"443"},d=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,h=["file:","data:"];const f=({name:e,message:n,stack:t})=>({name:e,message:n,stack:t});let m=0;var p=()=>++m,v=(e,n,t,o,a)=>{const{localName:l,local:u,remote:d,originForSending:h,originForReceiving:f}=n;let m=!1;a(`${l}: Connecting call sender`);const v=e=>(...n)=>{let t;a(`${l}: Sending ${e}() call`);try{d.closed&&(t=!0)}catch(e){t=!0}if(t&&o(),m){const n=new Error(`Unable to send ${e}() call due to destroyed connection`);throw n.code=s.ConnectionDestroyed,n}return new Promise(((t,o)=>{const s=p(),m=n=>{if(n.source!==d||n.data.penpal!==r.Reply||n.data.id!==s)return;if(n.origin!==f)return void a(`${l} received message from origin ${n.origin} which did not match expected origin ${f}`);const h=n.data;a(`${l}: Received ${e}() reply`),u.removeEventListener(c.Message,m);let p=h.returnValue;h.returnValueIsError&&(p=(e=>{const n=new Error;return Object.keys(e).forEach((t=>n[t]=e[t])),n})(p)),(h.resolution===i.Fulfilled?t:o)(p)};u.addEventListener(c.Message,m);const v={penpal:r.Call,id:s,methodName:e,args:n};d.postMessage(v,h)}))};return t.reduce(((e,n)=>(e[n]=v(n),e)),e),()=>{m=!0}},w=(e,n,t,o,s)=>{const{destroy:l,onDestroy:u}=o;let d,h;const m={};return o=>{if(o.origin!==n)return void s(`Parent: Handshake - Received ACK message from origin ${o.origin} which did not match expected origin ${n}`);s("Parent: Handshake - Received ACK");const p={localName:"Parent",local:window,remote:o.source,originForSending:t,originForReceiving:n};d&&d(),d=((e,n,t)=>{const{localName:o,local:s,remote:l,originForSending:u,originForReceiving:d}=e;let h=!1;const m=e=>{if(e.source!==l||e.data.penpal!==r.Call)return;if(e.origin!==d)return void t(`${o} received message from origin ${e.origin} which did not match expected origin ${d}`);const s=e.data,{methodName:c,args:m,id:p}=s;t(`${o}: Received ${c}() call`);const v=e=>n=>{if(t(`${o}: Sending ${c}() reply`),h)return void t(`${o}: Unable to send ${c}() reply due to destroyed connection`);const s={penpal:r.Reply,id:p,resolution:e,returnValue:n};e===i.Rejected&&n instanceof Error&&(s.returnValue=f(n),s.returnValueIsError=!0);try{l.postMessage(s,u)}catch(e){if(e.name===a.DataCloneError){const n={penpal:r.Reply,id:p,resolution:i.Rejected,returnValue:f(e),returnValueIsError:!0};l.postMessage(n,u)}throw e}};new Promise((e=>e(n[c].apply(n,m)))).then(v(i.Fulfilled),v(i.Rejected))};return s.addEventListener(c.Message,m),()=>{h=!0,s.removeEventListener(c.Message,m)}})(p,e,s),u(d),h&&h.forEach((e=>{delete m[e]})),h=o.data.methodNames;const w=v(m,p,h,l,s);return u(w),m}};var g=e=>{let{iframe:n,methods:t={},childOrigin:o,timeout:i,debug:a=!1}=e;const l=(e=>(...n)=>{e&&console.log("[Penpal]",...n)})(a),f=(()=>{const e=[];let n=!1;return{destroy(t){n=!0,e.forEach((e=>{e(t)}))},onDestroy(t){n?t():e.push(t)}}})(),{onDestroy:m,destroy:p}=f;o||((e=>{if(!e.src&&!e.srcdoc){const e=new Error("Iframe must have src or srcdoc property defined.");throw e.code=s.NoIframeSrc,e}})(n),o=(e=>{if(e&&h.find((n=>e.startsWith(n))))return"null";const n=document.location,t=d.exec(e);let o,r,i;return t?(o=t[1]?t[1]:n.protocol,r=t[2],i=t[4]):(o=n.protocol,r=n.hostname,i=n.port),`${o}//${r}${i&&i!==u[o]?`:${i}`:""}`})(n.src));const v="null"===o?"*":o,g=((e,n,t,o)=>i=>{if(i.origin!==t)return void e(`Parent: Handshake - Received SYN message from origin ${i.origin} which did not match expected origin ${t}`);e("Parent: Handshake - Received SYN, responding with SYN-ACK");const s={penpal:r.SynAck,methodNames:Object.keys(n)};i.source.postMessage(s,o)})(l,t,o,v),y=w(t,o,v,f,l);return{promise:new Promise(((e,t)=>{const o=((e,n)=>{let t;return void 0!==e&&(t=window.setTimeout((()=>{const t=new Error(`Connection timed out after ${e}ms`);t.code=s.ConnectionTimeout,n(t)}),e)),()=>{clearTimeout(t)}})(i,p),a=t=>{if(t.source===n.contentWindow&&t.data)if(t.data.penpal!==r.Syn)if(t.data.penpal!==r.Ack);else{const n=y(t);n&&(o(),e(n))}else g(t)};window.addEventListener(c.Message,a),l("Parent: Awaiting handshake"),((e,n)=>{const{destroy:t,onDestroy:o}=n,r=setInterval((()=>{e.isConnected||(clearInterval(r),t())}),6e4);o((()=>{clearInterval(r)}))})(n,f),m((e=>{window.removeEventListener(c.Message,a),e||((e=new Error("Connection destroyed")).code=s.ConnectionDestroyed),t(e)}))})),destroy(){p()}}},y=function(e){return void 0===e.value&&void 0===e.info&&void 0===e.selectOptions&&void 0===e.manyToOne},k=function(n){var t=e({},n);return t.validators&&(t.validators=t.validators.map((function(n){return("regex_match"===n.validate||"regex_exclude"===n.validate)&&n.regex instanceof RegExp?e(e({},n),{regex:n.regex.source,regexOptions:{ignoreCase:n.regex.flags.includes("i"),dotAll:n.regex.flags.includes("s"),multiline:n.regex.flags.includes("m"),unicode:n.regex.flags.includes("u")}}):n}))),t},b=function(e){return setTimeout((function(){console.warn("[Dromo Error] Slow ".concat(e," detected (>10s). Long running hooks can degrade user experience and importer performance."))}),1e4)},E=function(e){clearTimeout(e)};return function(){function o(o,r,i,s){var a=this;this.columnHooks=[],this.bulkRowHooks=[],this.rowHooks=[],this.stepHooks=[],this.rowDeleteHooks=[],this.initChild=function(){return n(a,void 0,void 0,(function(){var n,o,r,i,s;return t(this,(function(t){switch(t.label){case 0:return this.connection?[4,this.connection.promise]:(console.error("shim cannot connect with Dromo service."),alert("There was en error opening the importer. Please contact support if this issue persists."),[2]);case 1:return n=t.sent(),o=Array.from(document.getElementsByTagName("script")).some((function(e){return"https://unpkg.com/dromo-uploader-js/dist/DromoUploader.js"===e.src||"https://cdn.jsdelivr.net/npm/dromo-uploader-js@latest/dist/DromoUploader.js"===e.src})),[4,n.setNumRegisteredRowHooks(this.totalNumRowHooks())];case 2:return t.sent(),[4,n.setNumRegisteredColHooks(this.columnHooks.length)];case 3:return t.sent(),[4,n.setNumRegisteredRowDeleteHooks(this.rowDeleteHooks.length)];case 4:return t.sent(),this.fields&&this.settings&&this.user?(r=e({},this.settings),o||(r.version=null!==(i=r.version)&&void 0!==i?i:"v2"),r.browserExcelParsing=null===(s=r.browserExcelParsing)||void 0===s||s,[4,n.init(this.licenseKey,this.fields,r,this.user,this.appHost)]):[3,6];case 5:return t.sent(),[3,9];case 6:return this.schemaId?[4,n.initFromSavedSchema(this.licenseKey,this.schemaId,this.appHost,{user:this.user,developmentMode:this.developmentMode,headerRowOverride:this.headerRowOverride})]:[3,8];case 7:return t.sent(),[3,9];case 8:console.error("Invalid Dromo configuration"),t.label=9;case 9:return[2]}}))}))},this.initIFrame=function(){var e,n,t,o,r;if(window.DROMO_WIDGET_OVERRIDE)r=window.DROMO_WIDGET_OVERRIDE;else if(null===(e=a.settings)||void 0===e?void 0:e.alternateDomain){var i=new URL(a.settings.alternateDomain);r=i.protocol+"//widget."+i.host}else r="v1"===(null===(n=a.settings)||void 0===n?void 0:n.version)?"https://widget-v1.dromo.io/":l;if(!document.getElementById(a.iframeId)){var s=document.createElement("iframe"),c=null!==(o=null===(t=a.settings)||void 0===t?void 0:t.importIdentifier)&&void 0!==o?o:a.schemaId;s.title=c?"Dromo Importer: ".concat(c):"Dromo Importer",s.src=r,s.id=a.iframeId,s.style.height="100%",s.style.width="100%",s.style.border="0",s.crossorigin="anonymous",a.iframe=s}},this.createConnection=function(){var o=a,r=a.iframe;r?a.connection=g({iframe:r,methods:{handleColumnHooks:function(r,i){return n(this,void 0,void 0,(function(){var s,a,c,l,u=this;return t(this,(function(d){switch(d.label){case 0:return s=o.columnHooks.filter((function(e){return e.fieldName===r})),a=new Map,c=i,[4,s.reduce((function(e,o){return n(u,void 0,void 0,(function(){var r=this;return t(this,(function(i){switch(i.label){case 0:return[4,e.then((function(){return n(r,void 0,void 0,(function(){var e,n,r;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),e=b("column hook"),[4,o.callback(c)];case 1:return n=t.sent(),E(e),n.forEach((function(e){if(void 0!==e.value||void 0!==e.info){var n={};void 0!==e.value&&(n.value=e.value,c[e.index]=e.value),void 0!==e.info&&(n.info=e.info),a.set(e.index,n)}})),[3,3];case 2:return r=t.sent(),console.error("[Dromo-External-Error] There was an error running your col hook.",r),[3,3];case 3:return[2]}}))}))}))];case 1:return i.sent(),[2]}}))}))}),Promise.resolve())];case 1:return d.sent(),l=[],a.forEach((function(n,t){return l.push(e(e({},n),{index:t}))})),[2,l]}}))}))},handleRowHooks:function(e,r){return n(this,void 0,void 0,(function(){var i,s,a,c,l,u,d,h,f,m,p,v,w,g=this;return t(this,(function(k){switch(k.label){case 0:i=new Map,s=new Map(e.map((function(e){return[e.index,e]}))),a=function(e,n){for(var t,o=s.get(e),r=function(n,r){if(y(r))return"continue";var s=o.row[n],a=Array.isArray(s.manyToOne),c="manyToOne"in r&&Array.isArray(r.manyToOne);if(a&&!c)throw new Error("".concat(n," should have manyToOne defined as an array."));if(a&&c&&s.manyToOne.length!==r.manyToOne.length)throw new Error("".concat(n," should be array of length ").concat(s.manyToOne.length));var l=i.get(e)||{},u=null!==(t=l[n])&&void 0!==t?t:{},d=[];c?(u.manyToOne=[],r.manyToOne.forEach((function(e,n){if(!y(e)){var t={};u.manyToOne.push(t),d.push({fieldOutput:e,rowDataField:s.manyToOne[n],cellChange:t})}}))):d.push({fieldOutput:r,rowDataField:s,cellChange:u}),d.forEach((function(e){var n=e.fieldOutput,t=e.rowDataField,o=e.cellChange;void 0!==n.value&&(o.value=n.value,t.value=n.value),void 0!==n.info&&(o.info=n.info,t.info=n.info),void 0!==n.selectOptions&&(o.selectOptions=n.selectOptions,t.selectOptions=n.selectOptions)})),l[n]=u,i.set(e,l)},a=0,c=Object.entries(null!=n?n:{});a<c.length;a++){var l=c[a];r(l[0],l[1])}},c=0,l=o.bulkRowHooks,k.label=1;case 1:if(!(c<l.length))return[3,6];u=l[c],k.label=2;case 2:return k.trys.push([2,4,,5]),d=b("bulk row hook"),[4,u(e,r)];case 3:for(h=k.sent(),E(d),f=0,m=h;f<m.length;f++)p=m[f],a(p.index,p.row);return[3,5];case 4:return v=k.sent(),console.error("[Dromo-External-Error] There was an error running your bulk row hook.",v),[3,5];case 5:return c++,[3,1];case 6:return[4,Promise.all(e.map((function(e){return n(g,void 0,void 0,(function(){var n,i,s,c,l,u;return t(this,(function(t){switch(t.label){case 0:n=0,i=o.rowHooks,t.label=1;case 1:if(!(n<i.length))return[3,6];s=i[n],t.label=2;case 2:return t.trys.push([2,4,,5]),c=b("row hook"),[4,s.callback(e,r)];case 3:return l=t.sent(),E(c),a(e.index,l.row),[3,5];case 4:return u=t.sent(),console.error("[Dromo-External-Error] There was an error running your row hook.",u),[3,5];case 5:return n++,[3,1];case 6:return[2]}}))}))})))];case 7:return k.sent(),w=[],i.forEach((function(e,n){w.push({index:n,row:e})})),[2,w]}}))}))},handleStepHook:function(e,n){o.stepHooks.forEach((function(t){if(e===t.type)try{t.callback(o,n)}catch(e){console.error("[Dromo-External-Error] There was an error in your step callback.",e)}}))},handleRowDeleteHooks:function(e){var r=this;return Promise.all(e.map((function(e){return n(r,void 0,void 0,(function(){var r=this;return t(this,(function(i){switch(i.label){case 0:return[4,o.rowDeleteHooks.forEach((function(o){return n(r,void 0,void 0,(function(){var n,r;return t(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),n=b("row delete hook"),[4,o(e)];case 1:return t.sent(),E(n),[3,3];case 2:return r=t.sent(),console.error("[Dromo-External-Error] There was an error running your row delete hook.",r),[3,3];case 3:return[2]}}))}))}))];case 1:return i.sent(),[2]}}))}))})))},handleBeforeFinishCallback:function(e,r){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:if(!o.beforeFinishCallback)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.beforeFinishCallback(e,r,o)];case 2:return[2,t.sent()];case 3:return n=t.sent(),console.error("[Dromo-External-Error] There was an error in your beforeFinish callback.",n),[3,4];case 4:return[2]}}))}))},handleResults:function(e,r){return n(this,void 0,void 0,(function(){var n;return t(this,(function(t){switch(t.label){case 0:if(!o.resultsCallback)return[3,4];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,o.resultsCallback(e,r)];case 2:return t.sent(),[3,4];case 3:return n=t.sent(),console.error("[Dromo-External-Error] There was an error in your onResult callback.",n),[3,4];case 4:return o.close(),[2]}}))}))},handleCloseModal:function(){o.close()},handleCancel:function(){if(o.cancelCallback)try{o.cancelCallback()}catch(e){console.error("[Dromo-External-Error] There was an error in your cancel callback.",e)}o.close()}}}):console.error("shim cannot connect to Dromo.")},this.mountIFrame=function(){if(!document.getElementById(a.iframeId)){var e=document.createElement("div");e.id=a.wrapperId,e.style.zIndex=Number.MAX_SAFE_INTEGER.toString(),e.style.visibility="hidden",e.style.width="0px",e.style.height="0px",e.style.position="fixed",e.style.top="0px",e.style.left="0px",e.style.right="0px",e.style.bottom="0px",e.appendChild(a.iframe),document.body.appendChild(e),a.wrapper=e}},this.showIFrame=function(){a.wrapper&&(a.wrapper.style.visibility="visible",a.wrapper.style.width="100%",a.wrapper.style.height="100%",document.body.style.overflow="hidden")},this.registerColumnHook=function(e,n){a.columnHooks.push({fieldName:e,callback:n}),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredColHooks(a.columnHooks.length)}))},this.totalNumRowHooks=function(){return a.rowHooks.length+a.bulkRowHooks.length},this.registerBulkRowHook=function(e){a.bulkRowHooks.push(e),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowHooks(a.totalNumRowHooks())}))},this.registerRowHook=function(e){a.rowHooks.push({callback:e}),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowHooks(a.totalNumRowHooks())}))},this.registerStepHook=function(e,n){a.stepHooks.push({type:e,callback:n})},this.registerRowDeleteHook=function(e){a.rowDeleteHooks.push(e),a.connection&&a.connection.promise.then((function(e){e.setNumRegisteredRowDeleteHooks(a.rowDeleteHooks.length)}))},this.beforeFinish=function(e){a.beforeFinishCallback=e},this.registerAllHooks=function(e){if(e.columnHooks)for(var n=0,t=e.columnHooks;n<t.length;n++){var o=t[n],r=o.fieldName,i=o.callback;a.registerColumnHook(r,i)}if(e.rowHooks)for(var s=0,c=e.rowHooks;s<c.length;s++){var l=c[s];a.registerRowHook(l)}if(e.bulkRowHooks)for(var u=0,d=e.bulkRowHooks;u<d.length;u++){var h=d[u];a.registerBulkRowHook(h)}if(e.rowDeleteHooks)for(var f=0,m=e.rowDeleteHooks;f<m.length;f++){var p=m[f];a.registerRowDeleteHook(p)}if(e.stepHooks)for(var v=0,w=e.stepHooks;v<w.length;v++){var g=w[v],y=g.type;i=g.callback;a.registerStepHook(y,i)}e.beforeFinishCallback&&a.beforeFinish(e.beforeFinishCallback)},this.onResults=function(e){a.resultsCallback=e},this.onCancel=function(e){a.cancelCallback=e},this.setUser=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.user=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setUser(this.user)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.addField=function(e,o){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().addField(k(e),o)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.removeField=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().removeField(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.updateInfoMessages=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().updateInfoMessages(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.setHeaderRowOverride=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.headerRowOverride=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setHeaderRowOverride(e)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.open=function(){return n(a,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return this.wrapper||(this.initIFrame(),this.createConnection(),this.mountIFrame()),[4,this.initChild()];case 1:return e.sent(),this.showIFrame(),[2]}}))}))},this.addRows=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().addRows(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.removeRows=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().removeRows(e)];case 2:return n.sent(),[3,4];case 3:console.error("[Dromo-Error] Invalid connection to Dromo Uploader."),n.label=4;case 4:return[2]}}))}))},this.close=function(){a.wrapper&&(a.wrapper.style.visibility="hidden",a.wrapper.style.width="0px",a.wrapper.style.height="0px",document.body.style.overflow="inherit")},this.setDevelopmentMode=function(e){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.developmentMode=e,this.connection?[4,this.connection.promise]:[3,3];case 1:return[4,n.sent().setDevelopmentMode(this.developmentMode)];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},this.rehydrate=function(e,o){return n(a,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return this.wrapper||(this.initIFrame(),this.createConnection(),this.mountIFrame()),[4,this.initChild()];case 1:return n.sent(),[4,this.connection.promise];case 2:return[4,n.sent().rehydrate(e,o)];case 3:return n.sent(),this.showIFrame(),[2]}}))}))},this.iframeId=Math.random().toString(36).substring(7)+"-dromo-iframe-element",this.wrapperId=Math.random().toString(36).substring(7)+"-dromo-container",this.appHost=document.location.hostname,void 0!==i&&void 0!==s?(this.licenseKey=o,this.fields=r.map(k),this.settings=i,this.user=s,this.checkCloneable({licenseKey:this.licenseKey,fields:this.fields,settings:this.settings,user:this.user})):(this.licenseKey=o,this.schemaId=r,this.checkCloneable({licenseKey:this.licenseKey,schemaId:this.schemaId}))}var r;return o.prototype.checkCloneable=function(e){if("function"==typeof structuredClone){var n=Object.entries(e).filter((function(e){e[0];var n=e[1];try{return structuredClone(n),!1}catch(e){return!0}})).map((function(e){return e[0]}));if(n.length>0){var t=n.join(", ");throw new Error("[Dromo-External-Error] The Dromo importer received non-cloneable parameters: ".concat(t,". See https://dromo.dev/err/clone"))}}},r=o,o.rehydrateHeadless=function(e){var i=e.licenseKey,s=e.headlessImportId,a=e.fields,c=e.settings,l=e.hooks,u=e.rehydrateState;return n(void 0,void 0,void 0,(function(){var e;return t(r,(function(n){switch(n.label){case 0:return(e=new o(i,a,c,{id:"headless-review"})).registerAllHooks(l),[4,e.rehydrate(u,s)];case 1:return n.sent(),e.open(),[2,e]}}))}))},o}()}));
//# sourceMappingURL=index.js.map
{
"name": "dromo-uploader-js",
"version": "2.0.16",
"version": "2.0.17",
"description": "Easy to use data (CSV, TSV, Excel) importer",

@@ -5,0 +5,0 @@ "author": "ankitgoyal100",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc