aw-wizard-forms 4.12.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/wizard-form.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WizardForm={})}(this,function(t){"use strict";function e(){if("undefined"==typeof document)return;const t=document.cookie.match(/hubspotutk=([^;]+)/);return t?t[1]:void 0}function s(t){const{portalId:s,formId:r,fieldMapping:i={},mock:o=!1}=t;return{name:"hubspot",mapFields(t){const e={};for(const[s,r]of Object.entries(t))e[i[s]||s]=r;return e},async submit(t,i){if(o)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,formData:t}};const a=`https://api.hsforms.com/submissions/v3/integration/submit/${s}/${r}`,n=this.mapFields(t),l={fields:Object.entries(n).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:i.pageUrl,pageName:i.pageTitle,hutk:e()}};try{const t=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});return t.ok?{success:!0,data:await t.json()}:{success:!1,error:(await t.json().catch(()=>({}))).message||"HubSpot submission failed: "+t.status}}catch(d){return{success:!1,error:d instanceof Error?d.message:"Network error"}}}}}function r(t){const{url:e,method:s="POST",headers:r={},fieldMapping:i={},mock:o=!1}=t;return{name:"webhook",mapFields(t){const e={};for(const[s,r]of Object.entries(t))e[i[s]||s]=r;return e},async submit(t,i){if(o)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,formData:t}};if(!e)return{success:!1,error:"Webhook URL is required"};const a={formData:this.mapFields(t),context:{pageUrl:i.pageUrl,pageTitle:i.pageTitle,referrer:i.referrer,submittedAt:i.timestamp}};try{const t=await fetch(e,{method:s,headers:{"Content-Type":"application/json",...r},body:JSON.stringify(a)});if(!t.ok){const e=await t.text().catch(()=>"");return{success:!1,error:`Webhook failed: ${t.status} ${e}`.trim()}}let i;try{i=await t.json()}catch{i={status:t.status}}return{success:!0,data:i}}catch(n){return{success:!1,error:n instanceof Error?n.message:"Network error"}}}}}function i(){return"undefined"!=typeof window&&void 0!==window.RevenueHero}function o(t){const{routerId:e,fieldMapping:s={},mock:r=!1}=t;return{name:"revenuehero",mapFields(t){const e={};for(const[r,i]of Object.entries(t))e[s[r]||r]=i;return e},async submit(t,s){if(r)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,scheduled:!0}};if(!e)return{success:!1,error:"RevenueHero router ID is required"};if(!i())return{success:!1,error:"RevenueHero SDK not loaded. Please load the SDK in your page."};const o=this.mapFields(t),a=(o.email||o.workEmail||"")+"";if(!a)return{success:!1,error:"Email is required for RevenueHero scheduling"};try{return window.RevenueHero.schedule({routerId:e,email:a,...o}),{success:!0,data:{scheduled:!0,email:a}}}catch(n){return{success:!1,error:n instanceof Error?n.message:"RevenueHero error"}}}}}const a=globalThis,n=a.ShadowRoot&&(void 0===a.ShadyCSS||a.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,l=Symbol(),d=new WeakMap;let h=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==l)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=d.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&d.set(e,t))}return t}toString(){return this.cssText}};const c=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,s,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[r+1],t[0]);return new h(s,t,l)},p=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new h("string"==typeof t?t:t+"",void 0,l))(e)})(t):t,{is:f,defineProperty:u,getOwnPropertyDescriptor:g,getOwnPropertyNames:w,getOwnPropertySymbols:m,getPrototypeOf:b}=Object,v=globalThis,_=v.trustedTypes,y=_?_.emptyScript:"",S=v.reactiveElementPolyfillSupport,x=(t,e)=>t,$={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(r){s=null}}return s}},k=(t,e)=>!f(t,e),E={attribute:!0,type:String,converter:$,reflect:!1,useDefault:!1,hasChanged:k};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),v.litPropertyMetadata??(v.litPropertyMetadata=new WeakMap);let C=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&u(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:i}=g(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const o=r?.call(this);i?.call(this,e),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??E}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=b(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const t=this.properties,e=[...w(t),...m(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const t=this._$Eu(e,s);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(p(t))}else void 0!==t&&e.push(p(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(n)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),r=a.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=s.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const i=(void 0!==s.converter?.toAttribute?s.converter:$).toAttribute(e,s.type);this._$Em=t,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:$;this._$Em=r;const o=i.fromAttribute(e,t.type);this[r]=o??this._$Ej?.get(r)??o,this._$Em=null}}requestUpdate(t,e,s,r=!1,i){if(void 0!==t){const o=this.constructor;if(!1===r&&(i=this[t]),s??(s=o.getPropertyOptions(t)),!((s.hasChanged??k)(i,e)||s.useDefault&&s.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:i},o){s&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==i||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,s,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};C.elementStyles=[],C.shadowRootOptions={mode:"open"},C[x("elementProperties")]=new Map,C[x("finalized")]=new Map,S?.({ReactiveElement:C}),(v.reactiveElementVersions??(v.reactiveElementVersions=[])).push("2.1.2");const A=globalThis,O=t=>t,W=A.trustedTypes,z=W?W.createPolicy("lit-html",{createHTML:t=>t}):void 0,P="$lit$",L=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+L,T=`<${N}>`,D=document,F=()=>D.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,B=Array.isArray,I="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,q=/-->/g,H=/>/g,V=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),U=/'/g,R=/"/g,Y=/^(?:script|style|textarea|title)$/i,K=(t,...e)=>({_$litType$:1,strings:t,values:e}),X=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),G=new WeakMap,Z=D.createTreeWalker(D,129);function Q(t,e){if(!B(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==z?z.createHTML(e):e}class tt{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let i=0,o=0;const a=t.length-1,n=this.parts,[l,d]=((t,e)=>{const s=t.length-1,r=[];let i,o=2===e?"<svg>":3===e?"<math>":"",a=j;for(let n=0;n<s;n++){const e=t[n];let s,l,d=-1,h=0;for(;h<e.length&&(a.lastIndex=h,l=a.exec(e),null!==l);)h=a.lastIndex,a===j?"!--"===l[1]?a=q:void 0!==l[1]?a=H:void 0!==l[2]?(Y.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=V):void 0!==l[3]&&(a=V):a===V?">"===l[0]?(a=i??j,d=-1):void 0===l[1]?d=-2:(d=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?V:'"'===l[3]?R:U):a===R||a===U?a=V:a===q||a===H?a=j:(a=V,i=void 0);const c=a===V&&t[n+1].startsWith("/>")?" ":"";o+=a===j?e+T:d>=0?(r.push(s),e.slice(0,d)+P+e.slice(d)+L+c):e+L+(-2===d?n:c)}return[Q(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]})(t,e);if(this.el=tt.createElement(l,s),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=Z.nextNode())&&n.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(P)){const e=d[o++],s=r.getAttribute(t).split(L),a=/([.?@])?(.*)/.exec(e);n.push({type:1,index:i,name:a[2],strings:s,ctor:"."===a[1]?ot:"?"===a[1]?at:"@"===a[1]?nt:it}),r.removeAttribute(t)}else t.startsWith(L)&&(n.push({type:6,index:i}),r.removeAttribute(t));if(Y.test(r.tagName)){const t=r.textContent.split(L),e=t.length-1;if(e>0){r.textContent=W?W.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],F()),Z.nextNode(),n.push({type:2,index:++i});r.append(t[e],F())}}}else if(8===r.nodeType)if(r.data===N)n.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(L,t+1));)n.push({type:7,index:i}),t+=L.length-1}i++}}static createElement(t,e){const s=D.createElement("template");return s.innerHTML=t,s}}function et(t,e,s=t,r){if(e===X)return e;let i=void 0!==r?s._$Co?.[r]:s._$Cl;const o=M(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,s,r)),void 0!==r?(s._$Co??(s._$Co=[]))[r]=i:s._$Cl=i),void 0!==i&&(e=et(t,i._$AS(t,e.values),i,r)),e}class st{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??D).importNode(e,!0);Z.currentNode=r;let i=Z.nextNode(),o=0,a=0,n=s[0];for(;void 0!==n;){if(o===n.index){let e;2===n.type?e=new rt(i,i.nextSibling,this,t):1===n.type?e=new n.ctor(i,n.name,n.strings,this,t):6===n.type&&(e=new lt(i,this,t)),this._$AV.push(e),n=s[++a]}o!==n?.index&&(i=Z.nextNode(),o++)}return Z.currentNode=D,r}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class rt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=et(this,t,e),M(t)?t===J||null==t||""===t?(this._$AH!==J&&this._$AR(),this._$AH=J):t!==this._$AH&&t!==X&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>B(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==J&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(D.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=tt.createElement(Q(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new st(r,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new tt(t)),e}k(t){B(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const i of t)r===e.length?e.push(s=new rt(this.O(F()),this.O(F()),this,this.options)):s=e[r],s._$AI(i),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=O(t).nextSibling;O(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,i){this.type=1,this._$AH=J,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=J}_$AI(t,e=this,s,r){const i=this.strings;let o=!1;if(void 0===i)t=et(this,t,e,0),o=!M(t)||t!==this._$AH&&t!==X,o&&(this._$AH=t);else{const r=t;let a,n;for(t=i[0],a=0;a<i.length-1;a++)n=et(this,r[s+a],e,a),n===X&&(n=this._$AH[a]),o||(o=!M(n)||n!==this._$AH[a]),n===J?t=J:t!==J&&(t+=(n??"")+i[a+1]),this._$AH[a]=n}o&&!r&&this.j(t)}j(t){t===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ot extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===J?void 0:t}}class at extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==J)}}class nt extends it{constructor(t,e,s,r,i){super(t,e,s,r,i),this.type=5}_$AI(t,e=this){if((t=et(this,t,e,0)??J)===X)return;const s=this._$AH,r=t===J&&s!==J||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==J&&(s===J||r);r&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class lt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const dt=A.litHtmlPolyfillSupport;dt?.(tt,rt),(A.litHtmlVersions??(A.litHtmlVersions=[])).push("3.3.2");const ht=globalThis;class ct extends C{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const r=s?.renderBefore??e;let i=r._$litPart$;if(void 0===i){const t=s?.renderBefore??null;r._$litPart$=i=new rt(e.insertBefore(F(),t),t,void 0,s??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}}ct._$litElement$=!0,ct.finalized=!0,ht.litElementHydrateSupport?.({LitElement:ct});const pt=ht.litElementPolyfillSupport;pt?.({LitElement:ct}),(ht.litElementVersions??(ht.litElementVersions=[])).push("4.2.2");const ft=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},ut={attribute:!0,type:String,converter:$,reflect:!1,hasChanged:k},gt=(t=ut,e,s)=>{const{kind:r,metadata:i}=s;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),"setter"===r&&((t=Object.create(t)).wrapped=!0),o.set(s.name,t),"accessor"===r){const{name:r}=s;return{set(s){const i=e.get.call(this);e.set.call(this,s),this.requestUpdate(r,i,t,!0,s)},init(e){return void 0!==e&&this.C(r,void 0,t,e),e}}}if("setter"===r){const{name:r}=s;return function(s){const i=this[r];e.call(this,s),this.requestUpdate(r,i,t,!0,s)}}throw Error("Unsupported decorator location: "+r)};function wt(t){return(e,s)=>"object"==typeof s?gt(t,e,s):((t,e,s)=>{const r=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),r?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}function mt(t){return wt({...t,state:!0,attribute:!1})}function bt(t,e){return(e,s,r)=>((t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s))(e,s,{get(){return e=this,e.renderRoot?.querySelector(t)??null;var e}})}const vt=c`
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).WizardForm={})}(this,function(t){"use strict";function e(){if("undefined"==typeof document)return;const t=document.cookie.match(/hubspotutk=([^;]+)/);return t?t[1]:void 0}function s(t){const{portalId:s,formId:r,fieldMapping:i={},mock:o=!1}=t;return{name:"hubspot",mapFields(t){const e={};for(const[s,r]of Object.entries(t))e[i[s]||s]=r;return e},async submit(t,i){if(o)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,formData:t}};const a=`https://api.hsforms.com/submissions/v3/integration/submit/${s}/${r}`,n=this.mapFields(t),l={fields:Object.entries(n).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:i.pageUrl,pageName:i.pageTitle,hutk:e()}};try{const t=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)});return t.ok?{success:!0,data:await t.json()}:{success:!1,error:(await t.json().catch(()=>({}))).message||"HubSpot submission failed: "+t.status}}catch(d){return{success:!1,error:d instanceof Error?d.message:"Network error"}}}}}function r(t){const{url:e,method:s="POST",headers:r={},fieldMapping:i={},mock:o=!1}=t;return{name:"webhook",mapFields(t){const e={};for(const[s,r]of Object.entries(t))e[i[s]||s]=r;return e},async submit(t,i){if(o)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,formData:t}};if(!e)return{success:!1,error:"Webhook URL is required"};const a={formData:this.mapFields(t),context:{pageUrl:i.pageUrl,pageTitle:i.pageTitle,referrer:i.referrer,submittedAt:i.timestamp}};try{const t=await fetch(e,{method:s,headers:{"Content-Type":"application/json",...r},body:JSON.stringify(a)});if(!t.ok){const e=await t.text().catch(()=>"");return{success:!1,error:`Webhook failed: ${t.status} ${e}`.trim()}}let i;try{i=await t.json()}catch{i={status:t.status}}return{success:!0,data:i}}catch(n){return{success:!1,error:n instanceof Error?n.message:"Network error"}}}}}function i(){return"undefined"!=typeof window&&void 0!==window.RevenueHero}function o(t){const{routerId:e,fieldMapping:s={},mock:r=!1}=t;return{name:"revenuehero",mapFields(t){const e={};for(const[r,i]of Object.entries(t))e[s[r]||r]=i;return e},async submit(t,s){if(r)return await new Promise(t=>setTimeout(t,500)),{success:!0,data:{mock:!0,scheduled:!0}};if(!e)return{success:!1,error:"RevenueHero router ID is required"};if(!i())return{success:!1,error:"RevenueHero SDK not loaded. Please load the SDK in your page."};const o=this.mapFields(t),a=(o.email||o.workEmail||"")+"";if(!a)return{success:!1,error:"Email is required for RevenueHero scheduling"};try{return window.RevenueHero.schedule({routerId:e,email:a,...o}),{success:!0,data:{scheduled:!0,email:a}}}catch(n){return{success:!1,error:n instanceof Error?n.message:"RevenueHero error"}}}}}const a=globalThis,n=a.ShadowRoot&&(void 0===a.ShadyCSS||a.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,l=Symbol(),d=new WeakMap;let h=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==l)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(n&&void 0===t){const s=void 0!==e&&1===e.length;s&&(t=d.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&d.set(e,t))}return t}toString(){return this.cssText}};const c=(t,...e)=>{const s=1===t.length?t[0]:e.reduce((e,s,r)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+t[r+1],t[0]);return new h(s,t,l)},p=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new h("string"==typeof t?t:t+"",void 0,l))(e)})(t):t,{is:f,defineProperty:u,getOwnPropertyDescriptor:g,getOwnPropertyNames:w,getOwnPropertySymbols:m,getPrototypeOf:b}=Object,v=globalThis,_=v.trustedTypes,y=_?_.emptyScript:"",S=v.reactiveElementPolyfillSupport,x=(t,e)=>t,$={toAttribute(t,e){switch(e){case Boolean:t=t?y:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(r){s=null}}return s}},k=(t,e)=>!f(t,e),E={attribute:!0,type:String,converter:$,reflect:!1,useDefault:!1,hasChanged:k};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),v.litPropertyMetadata??(v.litPropertyMetadata=new WeakMap);let A=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=E){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&u(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:i}=g(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:r,set(e){const o=r?.call(this);i?.call(this,e),this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??E}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=b(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const t=this.properties,e=[...w(t),...m(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[e,s]of this.elementProperties){const t=this._$Eu(e,s);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(p(t))}else void 0!==t&&e.push(p(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{if(n)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const s of e){const e=document.createElement("style"),r=a.litNonce;void 0!==r&&e.setAttribute("nonce",r),e.textContent=s.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$ET(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const i=(void 0!==s.converter?.toAttribute?s.converter:$).toAttribute(e,s.type);this._$Em=t,null==i?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:$;this._$Em=r;const o=i.fromAttribute(e,t.type);this[r]=o??this._$Ej?.get(r)??o,this._$Em=null}}requestUpdate(t,e,s,r=!1,i){if(void 0!==t){const o=this.constructor;if(!1===r&&(i=this[t]),s??(s=o.getPropertyOptions(t)),!((s.hasChanged??k)(i,e)||s.useDefault&&s.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,s))))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:s,reflect:r,wrapped:i},o){s&&!(this._$Ej??(this._$Ej=new Map)).has(t)&&(this._$Ej.set(t,o??e??this[t]),!0!==i||void 0!==o)||(this._$AL.has(t)||(this.hasUpdated||s||(e=void 0),this._$AL.set(t,e)),!0===r&&this._$Em!==t&&(this._$Eq??(this._$Eq=new Set)).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,s]of t){const{wrapped:t}=s,r=this[e];!0!==t||this._$AL.has(e)||void 0===r||this.C(e,void 0,s,r)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(s){throw t=!1,this._$EM(),s}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&(this._$Eq=this._$Eq.forEach(t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[x("elementProperties")]=new Map,A[x("finalized")]=new Map,S?.({ReactiveElement:A}),(v.reactiveElementVersions??(v.reactiveElementVersions=[])).push("2.1.2");const C=globalThis,O=t=>t,W=C.trustedTypes,z=W?W.createPolicy("lit-html",{createHTML:t=>t}):void 0,P="$lit$",L=`lit$${Math.random().toFixed(9).slice(2)}$`,N="?"+L,T=`<${N}>`,D=document,F=()=>D.createComment(""),M=t=>null===t||"object"!=typeof t&&"function"!=typeof t,B=Array.isArray,I="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,q=/-->/g,H=/>/g,V=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),U=/'/g,R=/"/g,Y=/^(?:script|style|textarea|title)$/i,K=(t,...e)=>({_$litType$:1,strings:t,values:e}),X=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),G=new WeakMap,Z=D.createTreeWalker(D,129);function Q(t,e){if(!B(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==z?z.createHTML(e):e}class tt{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let i=0,o=0;const a=t.length-1,n=this.parts,[l,d]=((t,e)=>{const s=t.length-1,r=[];let i,o=2===e?"<svg>":3===e?"<math>":"",a=j;for(let n=0;n<s;n++){const e=t[n];let s,l,d=-1,h=0;for(;h<e.length&&(a.lastIndex=h,l=a.exec(e),null!==l);)h=a.lastIndex,a===j?"!--"===l[1]?a=q:void 0!==l[1]?a=H:void 0!==l[2]?(Y.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=V):void 0!==l[3]&&(a=V):a===V?">"===l[0]?(a=i??j,d=-1):void 0===l[1]?d=-2:(d=a.lastIndex-l[2].length,s=l[1],a=void 0===l[3]?V:'"'===l[3]?R:U):a===R||a===U?a=V:a===q||a===H?a=j:(a=V,i=void 0);const c=a===V&&t[n+1].startsWith("/>")?" ":"";o+=a===j?e+T:d>=0?(r.push(s),e.slice(0,d)+P+e.slice(d)+L+c):e+L+(-2===d?n:c)}return[Q(t,o+(t[s]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),r]})(t,e);if(this.el=tt.createElement(l,s),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=Z.nextNode())&&n.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(P)){const e=d[o++],s=r.getAttribute(t).split(L),a=/([.?@])?(.*)/.exec(e);n.push({type:1,index:i,name:a[2],strings:s,ctor:"."===a[1]?ot:"?"===a[1]?at:"@"===a[1]?nt:it}),r.removeAttribute(t)}else t.startsWith(L)&&(n.push({type:6,index:i}),r.removeAttribute(t));if(Y.test(r.tagName)){const t=r.textContent.split(L),e=t.length-1;if(e>0){r.textContent=W?W.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],F()),Z.nextNode(),n.push({type:2,index:++i});r.append(t[e],F())}}}else if(8===r.nodeType)if(r.data===N)n.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(L,t+1));)n.push({type:7,index:i}),t+=L.length-1}i++}}static createElement(t,e){const s=D.createElement("template");return s.innerHTML=t,s}}function et(t,e,s=t,r){if(e===X)return e;let i=void 0!==r?s._$Co?.[r]:s._$Cl;const o=M(e)?void 0:e._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(t),i._$AT(t,s,r)),void 0!==r?(s._$Co??(s._$Co=[]))[r]=i:s._$Cl=i),void 0!==i&&(e=et(t,i._$AS(t,e.values),i,r)),e}class st{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,r=(t?.creationScope??D).importNode(e,!0);Z.currentNode=r;let i=Z.nextNode(),o=0,a=0,n=s[0];for(;void 0!==n;){if(o===n.index){let e;2===n.type?e=new rt(i,i.nextSibling,this,t):1===n.type?e=new n.ctor(i,n.name,n.strings,this,t):6===n.type&&(e=new lt(i,this,t)),this._$AV.push(e),n=s[++a]}o!==n?.index&&(i=Z.nextNode(),o++)}return Z.currentNode=D,r}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class rt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=et(this,t,e),M(t)?t===J||null==t||""===t?(this._$AH!==J&&this._$AR(),this._$AH=J):t!==this._$AH&&t!==X&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>B(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==J&&M(this._$AH)?this._$AA.nextSibling.data=t:this.T(D.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=tt.createElement(Q(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new st(r,this),s=t.u(this.options);t.p(e),this.T(s),this._$AH=t}}_$AC(t){let e=G.get(t.strings);return void 0===e&&G.set(t.strings,e=new tt(t)),e}k(t){B(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const i of t)r===e.length?e.push(s=new rt(this.O(F()),this.O(F()),this,this.options)):s=e[r],s._$AI(i),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=O(t).nextSibling;O(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class it{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,i){this.type=1,this._$AH=J,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=i,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=J}_$AI(t,e=this,s,r){const i=this.strings;let o=!1;if(void 0===i)t=et(this,t,e,0),o=!M(t)||t!==this._$AH&&t!==X,o&&(this._$AH=t);else{const r=t;let a,n;for(t=i[0],a=0;a<i.length-1;a++)n=et(this,r[s+a],e,a),n===X&&(n=this._$AH[a]),o||(o=!M(n)||n!==this._$AH[a]),n===J?t=J:t!==J&&(t+=(n??"")+i[a+1]),this._$AH[a]=n}o&&!r&&this.j(t)}j(t){t===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class ot extends it{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===J?void 0:t}}class at extends it{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==J)}}class nt extends it{constructor(t,e,s,r,i){super(t,e,s,r,i),this.type=5}_$AI(t,e=this){if((t=et(this,t,e,0)??J)===X)return;const s=this._$AH,r=t===J&&s!==J||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,i=t!==J&&(s===J||r);r&&this.element.removeEventListener(this.name,this,s),i&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}}class lt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){et(this,t)}}const dt=C.litHtmlPolyfillSupport;dt?.(tt,rt),(C.litHtmlVersions??(C.litHtmlVersions=[])).push("3.3.2");const ht=globalThis;class ct extends A{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=((t,e,s)=>{const r=s?.renderBefore??e;let i=r._$litPart$;if(void 0===i){const t=s?.renderBefore??null;r._$litPart$=i=new rt(e.insertBefore(F(),t),t,void 0,s??{})}return i._$AI(t),i})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return X}}ct._$litElement$=!0,ct.finalized=!0,ht.litElementHydrateSupport?.({LitElement:ct});const pt=ht.litElementPolyfillSupport;pt?.({LitElement:ct}),(ht.litElementVersions??(ht.litElementVersions=[])).push("4.2.2");const ft=t=>(e,s)=>{void 0!==s?s.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},ut={attribute:!0,type:String,converter:$,reflect:!1,hasChanged:k},gt=(t=ut,e,s)=>{const{kind:r,metadata:i}=s;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),"setter"===r&&((t=Object.create(t)).wrapped=!0),o.set(s.name,t),"accessor"===r){const{name:r}=s;return{set(s){const i=e.get.call(this);e.set.call(this,s),this.requestUpdate(r,i,t,!0,s)},init(e){return void 0!==e&&this.C(r,void 0,t,e),e}}}if("setter"===r){const{name:r}=s;return function(s){const i=this[r];e.call(this,s),this.requestUpdate(r,i,t,!0,s)}}throw Error("Unsupported decorator location: "+r)};function wt(t){return(e,s)=>"object"==typeof s?gt(t,e,s):((t,e,s)=>{const r=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),r?Object.getOwnPropertyDescriptor(e,s):void 0})(t,e,s)}function mt(t){return wt({...t,state:!0,attribute:!1})}function bt(t,e){return(e,s,r)=>((t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,s),s))(e,s,{get(){return e=this,e.renderRoot?.querySelector(t)??null;var e}})}const vt=c`
|
|
2
2
|
:host {
|
|
3
3
|
${c`
|
|
4
4
|
/* Colors */
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
border-radius: var(--wf-radius-sm);
|
|
338
338
|
color: var(--wf-color-text-muted);
|
|
339
339
|
}
|
|
340
|
-
`;var Et=Object.defineProperty,
|
|
340
|
+
`;var Et=Object.defineProperty,At=Object.getOwnPropertyDescriptor,Ct=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?At(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Et(e,s,o),o};t.WfBadge=class extends ct{constructor(){super(...arguments),this.shortcut="",this.variant="default"}render(){return K`
|
|
341
341
|
<span
|
|
342
342
|
class="wf-badge wf-badge--${this.variant}"
|
|
343
343
|
aria-hidden="true"
|
|
@@ -345,7 +345,7 @@
|
|
|
345
345
|
>
|
|
346
346
|
${this.shortcut}
|
|
347
347
|
</span>
|
|
348
|
-
`}},t.WfBadge.styles=kt,
|
|
348
|
+
`}},t.WfBadge.styles=kt,Ct([wt({type:String})],t.WfBadge.prototype,"shortcut",2),Ct([wt({type:String})],t.WfBadge.prototype,"variant",2),t.WfBadge=Ct([ft("wf-badge")],t.WfBadge);var Ot=Object.defineProperty,Wt=Object.getOwnPropertyDescriptor,zt=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Wt(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Ot(e,s,o),o};t.WizardForm=class extends ct{constructor(){super(),this.hubspotPortal="",this.hubspotForm="",this.theme="light",this.mock=!1,this.showProgress=!1,this.autoAdvance=!0,this.hideBack=!0,this.submitOnStep=!1,this.noAutofocus=!1,this._steps=[],this._currentStep=1,this._totalSteps=0,this._formData={},this._submitting=!1,this.submitted=!1,this._error="",this._otherInputActive=!1,this._partialSubmitting=!1,this._stateController=new xt(this),this._handleFieldChange=t=>{const{name:e,value:s,extraFields:r}=t.detail;if(this._formData[e]=s,this._stateController.setValue(e,s),r){Object.entries(r).forEach(([t,e])=>{this._formData[t]=e,this._stateController.setValue(t,e)});const t=Object.values(r).some(t=>t&&(t+"").trim());this._otherInputActive=t}else this._otherInputActive=!1;this._error="",this.dispatchEvent(new CustomEvent("wf:field-change",{detail:{name:e,value:s,formData:{...this._formData}},bubbles:!0,composed:!0}))},this._handleOptionSelect=t=>{if(!this._stepHasComposableNav()&&this.autoAdvance){const e=t.target.closest("wf-options");e&&!e.hasAttribute("multi")&&setTimeout(()=>{this._goNext()},300)}},this._handleNavNext=async t=>{t.stopPropagation(),await this._goNext()},this._handleNavBack=t=>{t.stopPropagation(),this._goBack()},this._handleNavSkip=t=>{t.stopPropagation(),this._submitting||(this._currentStep>=this._totalSteps?this._submit():this._navigateToStep(this._currentStep+1,"forward"))},this._handleNavStateRequest=()=>{this._broadcastNavState()},new $t(this,{onEnter:()=>this._handleEnter(),onEscape:()=>this._handleEscape()})}connectedCallback(){super.connectedCallback(),this.addEventListener("wf-change",this._handleFieldChange),this.addEventListener("wf-option-select",this._handleOptionSelect),this.addEventListener("wf:nav-next",this._handleNavNext),this.addEventListener("wf:nav-back",this._handleNavBack),this.addEventListener("wf:nav-skip",this._handleNavSkip),this.addEventListener("wf:nav-state-request",this._handleNavStateRequest)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("wf-change",this._handleFieldChange),this.removeEventListener("wf-option-select",this._handleOptionSelect),this.removeEventListener("wf:nav-next",this._handleNavNext),this.removeEventListener("wf:nav-back",this._handleNavBack),this.removeEventListener("wf:nav-skip",this._handleNavSkip),this.removeEventListener("wf:nav-state-request",this._handleNavStateRequest)}firstUpdated(){this._discoverSteps(),this._showCurrentStep(),this._broadcastNavState()}render(){return this.submitted?(this._steps.forEach(t=>{t.active=!1}),K`
|
|
349
349
|
<div class="wf-container" data-testid="wf-container">
|
|
350
350
|
<slot name="success">
|
|
351
351
|
<div class="wf-success-screen">
|
|
@@ -364,7 +364,7 @@
|
|
|
364
364
|
<div
|
|
365
365
|
class="wf-progress-segment ${s?"completed":""} ${r?"active":""}"
|
|
366
366
|
></div>
|
|
367
|
-
`)}return K`<div class="wf-progress">${t}</div>`}_renderNavigation(){return J}_discoverSteps(){const t=this.shadowRoot?.querySelector("slot:not([name])");if(t){const e=t.assignedElements({flatten:!0});this._steps=e.filter(t=>"wf-step"===t.tagName.toLowerCase())}else this._steps=Array.from(this.querySelectorAll(":scope > wf-step"));this._steps.forEach((t,e)=>{t.step=e+1}),this._totalSteps=this._steps.length,this._stateController.setTotalSteps(this._totalSteps),document.dispatchEvent(new CustomEvent("wf:steps-discovered",{detail:{wizard:this,wizardId:this.id,totalSteps:this._totalSteps,currentStep:this._currentStep}}))}_showCurrentStep(){this._steps.forEach((t,e)=>{e+1===this._currentStep?t.show("forward"):t.active=!1})}_getStepByNumber(t){const e=t-1;return this._steps[e]}_stepRequiresManualNav(){if(!this.autoAdvance)return!0;const t=this._getStepByNumber(this._currentStep);if(!t)return!0;const e=["wf-input","wf-email","wf-textarea","wf-number"];for(const s of e)if(t.querySelector(s))return!0;return!!t.querySelector("wf-options[multi]")||!(!t.querySelector("wf-options[allow-other]")||!this._otherInputActive)}_stepHasComposableNav(){const t=this._getStepByNumber(this._currentStep);if(!t)return!1;const e=t.querySelectorAll("wf-next-btn, wf-back-btn");for(const s of e)if(!s.closest("wf-other"))return!0;return!1}_broadcastNavState(){this.dispatchEvent(new CustomEvent("wf:nav-state",{detail:{currentStep:this._currentStep,totalSteps:this._totalSteps,isFirstStep:1===this._currentStep,isLastStep:this._currentStep===this._totalSteps,isSubmitting:this._submitting},bubbles:!1}))}async _goNext(){if(this._submitting)return;const t=this._getStepByNumber(this._currentStep);t&&!(await t.validate())||(this._currentStep>=this._totalSteps?await this._submit():this._navigateToStep(this._currentStep+1,"forward"))}_goBack(){this._submitting||this._currentStep<=1||this._navigateToStep(this._currentStep-1,"backward")}async _navigateToStep(t,e){if(t<1||t>this._totalSteps)return;const s=this._getStepByNumber(t);if(!s)return;if(s.shouldSkip(this._formData)){const s="forward"===e?t+1:t-1;return s>=1&&s<=this._totalSteps?this._navigateToStep(s,e):void 0}const r=this._currentStep;this.submitOnStep&&this.hubspotPortal&&this.hubspotForm&&"forward"===e&&this._submitPartialToHubSpot().catch(t=>{this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:t instanceof Error?t.message:"Partial submission failed",formData:this._getFieldsUpToStep(this._currentStep)},bubbles:!0,composed:!0}))});const i=this._getStepByNumber(this._currentStep);i&&await i.hide(),this._currentStep=t,this._stateController.goToStep(t),this._otherInputActive=!1,this._broadcastNavState(),s.show(e),this.dispatchEvent(new CustomEvent("wf:step-change",{detail:{from:r,to:t,direction:e,submitted:!1,adapter:void 0},bubbles:!0,composed:!0}))}async _handleEnter(){await this._goNext()}_handleEscape(){this._goBack()}async _submit(){if(this._submitting)return;const t={...this._formData},e=new CustomEvent("wf:submit",{detail:{formData:t},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(e),e.defaultPrevented)return;this._submitting=!0,this._error="",this._broadcastNavState();let s=t;this.serialize&&(s=this.serialize(t));try{let t;this.mock?(await new Promise(t=>setTimeout(t,1e3)),t={success:!0}):t=this.hubspotPortal&&this.hubspotForm?await this._submitToHubSpot(s):{success:!0},this.submitted=!0,this.dispatchEvent(new CustomEvent("wf:success",{detail:{formData:s,response:t},bubbles:!0,composed:!0}))}catch(r){const t=r instanceof Error?r.message:"Submission failed";this._error=t,this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:t,formData:s},bubbles:!0,composed:!0}))}finally{this._submitting=!1,this._broadcastNavState()}}async _submitToHubSpot(t){const e=`https://api.hsforms.com/submissions/v3/integration/submit/${this.hubspotPortal}/${this.hubspotForm}`,s={fields:Object.entries(t).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:window.location.href,pageName:document.title}},r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok){const t=await r.json().catch(()=>({}));throw Error(t.message||"HubSpot submission failed: "+r.status)}return r.json()}_getFieldsUpToStep(t){const e={};for(let s=0;s<t&&s<this._steps.length;s++)this._steps[s].querySelectorAll("[name]").forEach(t=>{t.name&&void 0!==this._formData[t.name]&&(e[t.name]=this._formData[t.name])});return e}async _submitPartialToHubSpot(){let t={...this._getFieldsUpToStep(this._currentStep)};this.serialize&&(t=this.serialize(t));const e=Object.fromEntries(Object.entries(t).filter(([,t])=>null!=t&&""!==t&&(!Array.isArray(t)||0!==t.length)));await this._submitToHubSpot(e)}get formData(){return{...this._formData}}get currentStep(){return this._currentStep}get totalSteps(){return this._totalSteps}get isSubmitting(){return this._submitting}get isSubmitted(){return this.submitted}goToStep(t){const e=t>this._currentStep?"forward":"backward";this._navigateToStep(t,e)}next(){return this._goNext()}back(){this._goBack()}submit(){return this._submit()}reset(){this._formData={},this._currentStep=1,this._submitting=!1,this.submitted=!1,this._error="",this._stateController.reset(),this._showCurrentStep(),this._steps.forEach(t=>{t.querySelectorAll("wf-options, wf-field, wf-email").forEach(t=>{"reset"in t&&"function"==typeof t.reset&&t.reset()})})}setFormData(t){this._formData={...this._formData,...t},Object.entries(t).forEach(([t,e])=>{this._stateController.setValue(t,e)})}},t.WizardForm.styles=St,zt([wt({type:String,attribute:"hubspot-portal"})],t.WizardForm.prototype,"hubspotPortal",2),zt([wt({type:String,attribute:"hubspot-form"})],t.WizardForm.prototype,"hubspotForm",2),zt([wt({type:String,reflect:!0})],t.WizardForm.prototype,"theme",2),zt([wt({type:Boolean})],t.WizardForm.prototype,"mock",2),zt([wt({type:Boolean,attribute:"show-progress"})],t.WizardForm.prototype,"showProgress",2),zt([wt({type:Boolean,attribute:"auto-advance"})],t.WizardForm.prototype,"autoAdvance",2),zt([wt({type:Boolean,attribute:"hide-back"})],t.WizardForm.prototype,"hideBack",2),zt([wt({attribute:!1})],t.WizardForm.prototype,"serialize",2),zt([wt({type:Boolean,attribute:"submit-on-step"})],t.WizardForm.prototype,"submitOnStep",2),zt([mt()],t.WizardForm.prototype,"_steps",2),zt([mt()],t.WizardForm.prototype,"_currentStep",2),zt([mt()],t.WizardForm.prototype,"_totalSteps",2),zt([mt()],t.WizardForm.prototype,"_formData",2),zt([mt()],t.WizardForm.prototype,"_submitting",2),zt([wt({type:Boolean,reflect:!0})],t.WizardForm.prototype,"submitted",2),zt([mt()],t.WizardForm.prototype,"_error",2),zt([mt()],t.WizardForm.prototype,"_otherInputActive",2),t.WizardForm=zt([ft("wizard-form")],t.WizardForm),t.WfSuccess=class extends ct{render(){return K`<slot></slot>`}},t.WfSuccess.styles=c`
|
|
367
|
+
`)}return K`<div class="wf-progress">${t}</div>`}_renderNavigation(){return J}_discoverSteps(){const t=this.shadowRoot?.querySelector("slot:not([name])");if(t){const e=t.assignedElements({flatten:!0});this._steps=e.filter(t=>"wf-step"===t.tagName.toLowerCase())}else this._steps=Array.from(this.querySelectorAll(":scope > wf-step"));this._steps.forEach((t,e)=>{t.step=e+1,t.noAutofocus=this.noAutofocus}),this._totalSteps=this._steps.length,this._stateController.setTotalSteps(this._totalSteps),document.dispatchEvent(new CustomEvent("wf:steps-discovered",{detail:{wizard:this,wizardId:this.id,totalSteps:this._totalSteps,currentStep:this._currentStep}}))}_showCurrentStep(){this._steps.forEach((t,e)=>{e+1===this._currentStep?t.show("forward"):t.active=!1})}_getStepByNumber(t){const e=t-1;return this._steps[e]}_stepRequiresManualNav(){if(!this.autoAdvance)return!0;const t=this._getStepByNumber(this._currentStep);if(!t)return!0;const e=["wf-input","wf-email","wf-textarea","wf-number"];for(const s of e)if(t.querySelector(s))return!0;return!!t.querySelector("wf-options[multi]")||!(!t.querySelector("wf-options[allow-other]")||!this._otherInputActive)}_stepHasComposableNav(){const t=this._getStepByNumber(this._currentStep);if(!t)return!1;const e=t.querySelectorAll("wf-next-btn, wf-back-btn");for(const s of e)if(!s.closest("wf-other"))return!0;return!1}_broadcastNavState(){this.dispatchEvent(new CustomEvent("wf:nav-state",{detail:{currentStep:this._currentStep,totalSteps:this._totalSteps,isFirstStep:1===this._currentStep,isLastStep:this._currentStep===this._totalSteps,isSubmitting:this._submitting},bubbles:!1}))}async _goNext(){if(this._submitting)return;const t=this._getStepByNumber(this._currentStep);t&&!(await t.validate())||(this._currentStep>=this._totalSteps?await this._submit():this._navigateToStep(this._currentStep+1,"forward"))}_goBack(){this._submitting||this._currentStep<=1||this._navigateToStep(this._currentStep-1,"backward")}async _navigateToStep(t,e){if(t<1||t>this._totalSteps)return;const s=this._getStepByNumber(t);if(!s)return;if(s.shouldSkip(this._formData)){const s="forward"===e?t+1:t-1;return s>=1&&s<=this._totalSteps?this._navigateToStep(s,e):void 0}const r=this._currentStep;this.submitOnStep&&this.hubspotPortal&&this.hubspotForm&&"forward"===e&&this._submitPartialToHubSpot().catch(t=>{this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:t instanceof Error?t.message:"Partial submission failed",formData:this._getFieldsUpToStep(this._currentStep)},bubbles:!0,composed:!0}))});const i=this._getStepByNumber(this._currentStep);i&&await i.hide(),this._currentStep=t,this._stateController.goToStep(t),this._otherInputActive=!1,this._broadcastNavState(),s.show(e),this.dispatchEvent(new CustomEvent("wf:step-change",{detail:{from:r,to:t,direction:e,submitted:!1,adapter:void 0},bubbles:!0,composed:!0}))}async _handleEnter(){await this._goNext()}_handleEscape(){this._goBack()}async _submit(){if(this._submitting)return;const t={...this._formData},e=new CustomEvent("wf:submit",{detail:{formData:t},bubbles:!0,composed:!0,cancelable:!0});if(this.dispatchEvent(e),e.defaultPrevented)return;this._submitting=!0,this._error="",this._broadcastNavState();let s=t;this.serialize&&(s=this.serialize(t));try{let t;this.mock?(await new Promise(t=>setTimeout(t,1e3)),t={success:!0}):t=this.hubspotPortal&&this.hubspotForm?await this._submitToHubSpot(s):{success:!0},this.submitted=!0,this.dispatchEvent(new CustomEvent("wf:success",{detail:{formData:s,response:t},bubbles:!0,composed:!0}))}catch(r){const t=r instanceof Error?r.message:"Submission failed";this._error=t,this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:t,formData:s},bubbles:!0,composed:!0}))}finally{this._submitting=!1,this._broadcastNavState()}}async _submitToHubSpot(t){const e=`https://api.hsforms.com/submissions/v3/integration/submit/${this.hubspotPortal}/${this.hubspotForm}`,s={fields:Object.entries(t).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:window.location.href,pageName:document.title}},r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!r.ok){const t=await r.json().catch(()=>({}));throw Error(t.message||"HubSpot submission failed: "+r.status)}return r.json()}_getFieldsUpToStep(t){const e={};for(let s=0;s<t&&s<this._steps.length;s++)this._steps[s].querySelectorAll("[name]").forEach(t=>{t.name&&void 0!==this._formData[t.name]&&(e[t.name]=this._formData[t.name])});return e}async _submitPartialToHubSpot(){let t={...this._getFieldsUpToStep(this._currentStep)};this.serialize&&(t=this.serialize(t));const e=Object.fromEntries(Object.entries(t).filter(([,t])=>null!=t&&""!==t&&(!Array.isArray(t)||0!==t.length)));await this._submitToHubSpot(e)}get formData(){return{...this._formData}}get currentStep(){return this._currentStep}get totalSteps(){return this._totalSteps}get isSubmitting(){return this._submitting}get isSubmitted(){return this.submitted}goToStep(t){const e=t>this._currentStep?"forward":"backward";this._navigateToStep(t,e)}next(){return this._goNext()}back(){this._goBack()}submit(){return this._submit()}reset(){this._formData={},this._currentStep=1,this._submitting=!1,this.submitted=!1,this._error="",this._stateController.reset(),this._showCurrentStep(),this._steps.forEach(t=>{t.querySelectorAll("wf-options, wf-field, wf-email").forEach(t=>{"reset"in t&&"function"==typeof t.reset&&t.reset()})})}setFormData(t){this._formData={...this._formData,...t},Object.entries(t).forEach(([t,e])=>{this._stateController.setValue(t,e)})}},t.WizardForm.styles=St,zt([wt({type:String,attribute:"hubspot-portal"})],t.WizardForm.prototype,"hubspotPortal",2),zt([wt({type:String,attribute:"hubspot-form"})],t.WizardForm.prototype,"hubspotForm",2),zt([wt({type:String,reflect:!0})],t.WizardForm.prototype,"theme",2),zt([wt({type:Boolean})],t.WizardForm.prototype,"mock",2),zt([wt({type:Boolean,attribute:"show-progress"})],t.WizardForm.prototype,"showProgress",2),zt([wt({type:Boolean,attribute:"auto-advance"})],t.WizardForm.prototype,"autoAdvance",2),zt([wt({type:Boolean,attribute:"hide-back"})],t.WizardForm.prototype,"hideBack",2),zt([wt({attribute:!1})],t.WizardForm.prototype,"serialize",2),zt([wt({type:Boolean,attribute:"submit-on-step"})],t.WizardForm.prototype,"submitOnStep",2),zt([wt({type:Boolean,attribute:"no-autofocus"})],t.WizardForm.prototype,"noAutofocus",2),zt([mt()],t.WizardForm.prototype,"_steps",2),zt([mt()],t.WizardForm.prototype,"_currentStep",2),zt([mt()],t.WizardForm.prototype,"_totalSteps",2),zt([mt()],t.WizardForm.prototype,"_formData",2),zt([mt()],t.WizardForm.prototype,"_submitting",2),zt([wt({type:Boolean,reflect:!0})],t.WizardForm.prototype,"submitted",2),zt([mt()],t.WizardForm.prototype,"_error",2),zt([mt()],t.WizardForm.prototype,"_otherInputActive",2),t.WizardForm=zt([ft("wizard-form")],t.WizardForm),t.WfSuccess=class extends ct{render(){return K`<slot></slot>`}},t.WfSuccess.styles=c`
|
|
368
368
|
:host {
|
|
369
369
|
display: block;
|
|
370
370
|
}
|
|
@@ -424,11 +424,11 @@
|
|
|
424
424
|
color: var(--wf-color-text-muted);
|
|
425
425
|
font-size: var(--wf-font-size-xl);
|
|
426
426
|
}
|
|
427
|
-
`];var Lt=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,Tt=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Nt(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Lt(e,s,o),o};t.WfStep=class extends ct{constructor(){super(...arguments),this.step=0,this.active=!1,this.direction="forward",this.leaving=!1,this.skipIf="",this._fields=[]}render(){return K`
|
|
427
|
+
`];var Lt=Object.defineProperty,Nt=Object.getOwnPropertyDescriptor,Tt=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Nt(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Lt(e,s,o),o};t.WfStep=class extends ct{constructor(){super(...arguments),this.step=0,this.active=!1,this.direction="forward",this.leaving=!1,this.skipIf="",this.noAutofocus=!1,this._fields=[]}render(){return K`
|
|
428
428
|
<div class="wf-step-content" data-testid="wf-step-content">
|
|
429
429
|
<slot></slot>
|
|
430
430
|
</div>
|
|
431
|
-
`}firstUpdated(){this._discoverFields()}updated(t){t.has("active")&&this.active&&(this.leaving=!1,this._focusFirstField())}_discoverFields(){const t=["wf-options","wf-field","wf-email","wf-input","wf-textarea","wf-number","wf-select"],e=[],s=r=>{if(t.includes(r.tagName.toLowerCase())){const t=r.getAttribute("name");t&&e.push(t)}Array.from(r.children).forEach(s)};Array.from(this.children).forEach(s),this._fields=e}_focusFirstField(){requestAnimationFrame(()=>{for(const t of this.children){const e=this._findFocusable(t);if(e)return void e.focus()}})}_findFocusable(t){if(t instanceof HTMLElement&&"function"==typeof t.focus&&["wf-field","wf-email","wf-input","wf-textarea","wf-select"].includes(t.tagName.toLowerCase()))return t;for(const e of t.children){const t=this._findFocusable(e);if(t)return t}return null}get fields(){return[...this._fields]}shouldSkip(t){if(!this.skipIf)return!1;try{const e=this.skipIf.trim();if(e.startsWith("!"))return!t[e.slice(1)];if(e.includes("===")){const[s,r]=e.split("===").map(t=>t.trim());return t[s]===r.replace(/['"]/g,"")}if(e.includes("!==")){const[s,r]=e.split("!==").map(t=>t.trim());return t[s]!==r.replace(/['"]/g,"")}return!!t[e]}catch(e){return!1}}show(t="forward"){this.direction=t,this.leaving=!1,this.active=!0}hide(){return new Promise(t=>{this.leaving=!0;const e=()=>{this.active=!1,this.leaving=!1,this.removeEventListener("animationend",e),t()};this.addEventListener("animationend",e),setTimeout(()=>{this.active=!1,this.leaving=!1,this.removeEventListener("animationend",e),t()},300)})}async validate(){const t=[];let e=!0;const s=async r=>{"validate"in r&&"function"==typeof r.validate&&(await r.validate()||(t.push(r),e=!1));for(const t of r.children)await s(t)};for(const r of this.children)await s(r);if(t.length>0){const e=t[0];e.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{"focus"in e&&"function"==typeof e.focus&&e.focus()},100)}return e}},t.WfStep.styles=Pt,Tt([wt({type:Number,attribute:"data-step"})],t.WfStep.prototype,"step",2),Tt([wt({type:Boolean,reflect:!0})],t.WfStep.prototype,"active",2),Tt([wt({type:String,reflect:!0})],t.WfStep.prototype,"direction",2),Tt([wt({type:Boolean,reflect:!0})],t.WfStep.prototype,"leaving",2),Tt([wt({type:String,attribute:"data-skip-if"})],t.WfStep.prototype,"skipIf",2),Tt([mt()],t.WfStep.prototype,"_fields",2),t.WfStep=Tt([ft("wf-step")],t.WfStep);const Dt=c`
|
|
431
|
+
`}firstUpdated(){this._discoverFields()}updated(t){t.has("active")&&this.active&&(this.leaving=!1,this._focusFirstField())}_discoverFields(){const t=["wf-options","wf-field","wf-email","wf-input","wf-textarea","wf-number","wf-select"],e=[],s=r=>{if(t.includes(r.tagName.toLowerCase())){const t=r.getAttribute("name");t&&e.push(t)}Array.from(r.children).forEach(s)};Array.from(this.children).forEach(s),this._fields=e}_focusFirstField(){this.noAutofocus||requestAnimationFrame(()=>{for(const t of this.children){const e=this._findFocusable(t);if(e)return void e.focus()}})}_findFocusable(t){if(t instanceof HTMLElement&&"function"==typeof t.focus&&["wf-field","wf-email","wf-input","wf-textarea","wf-select"].includes(t.tagName.toLowerCase()))return t;for(const e of t.children){const t=this._findFocusable(e);if(t)return t}return null}get fields(){return[...this._fields]}shouldSkip(t){if(!this.skipIf)return!1;try{const e=this.skipIf.trim();if(e.startsWith("!"))return!t[e.slice(1)];if(e.includes("===")){const[s,r]=e.split("===").map(t=>t.trim());return t[s]===r.replace(/['"]/g,"")}if(e.includes("!==")){const[s,r]=e.split("!==").map(t=>t.trim());return t[s]!==r.replace(/['"]/g,"")}return!!t[e]}catch(e){return!1}}show(t="forward"){this.direction=t,this.leaving=!1,this.active=!0}hide(){return new Promise(t=>{this.leaving=!0;const e=()=>{this.active=!1,this.leaving=!1,this.removeEventListener("animationend",e),t()};this.addEventListener("animationend",e),setTimeout(()=>{this.active=!1,this.leaving=!1,this.removeEventListener("animationend",e),t()},300)})}async validate(){const t=[];let e=!0;const s=async r=>{"validate"in r&&"function"==typeof r.validate&&(await r.validate()||(t.push(r),e=!1));for(const t of r.children)await s(t)};for(const r of this.children)await s(r);if(t.length>0){const e=t[0];e.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{"focus"in e&&"function"==typeof e.focus&&e.focus()},100)}return e}},t.WfStep.styles=Pt,Tt([wt({type:Number,attribute:"data-step"})],t.WfStep.prototype,"step",2),Tt([wt({type:Boolean,reflect:!0})],t.WfStep.prototype,"active",2),Tt([wt({type:String,reflect:!0})],t.WfStep.prototype,"direction",2),Tt([wt({type:Boolean,reflect:!0})],t.WfStep.prototype,"leaving",2),Tt([wt({type:String,attribute:"data-skip-if"})],t.WfStep.prototype,"skipIf",2),Tt([wt({type:Boolean,attribute:"no-autofocus"})],t.WfStep.prototype,"noAutofocus",2),Tt([mt()],t.WfStep.prototype,"_fields",2),t.WfStep=Tt([ft("wf-step")],t.WfStep);const Dt=c`
|
|
432
432
|
:host {
|
|
433
433
|
display: block;
|
|
434
434
|
box-sizing: border-box;
|
|
@@ -1039,7 +1039,7 @@
|
|
|
1039
1039
|
aria-valuemin="1"
|
|
1040
1040
|
aria-valuemax="${this._totalSteps}"
|
|
1041
1041
|
></div>
|
|
1042
|
-
`)}return K`<div class="wf-progress" data-testid="wf-progress-bar" role="group" aria-label="Form progress">${t}</div>`}},t.WfProgress.styles=_e,xe([wt({type:String})],t.WfProgress.prototype,"for",2),xe([mt()],t.WfProgress.prototype,"_currentStep",2),xe([mt()],t.WfProgress.prototype,"_totalSteps",2),xe([mt()],t.WfProgress.prototype,"_isComplete",2),t.WfProgress=xe([ft("wf-progress")],t.WfProgress);var $e=Object.defineProperty,ke=(t,e,s,r)=>{for(var i,o=void 0,a=t.length-1;a>=0;a--)(i=t[a])&&(o=i(e,s,o)||o);return o&&$e(e,s,o),o};class Ee extends ct{constructor(){super(...arguments),this._isFirstStep=!0,this._isLastStep=!1,this._isSubmitting=!1,this._handleNavState=t=>{this._isFirstStep=t.detail.isFirstStep,this._isLastStep=t.detail.isLastStep,this._isSubmitting=t.detail.isSubmitting}}connectedCallback(){super.connectedCallback(),this._findWizardForm()?.addEventListener("wf:nav-state",this._handleNavState),this._requestNavState()}disconnectedCallback(){super.disconnectedCallback(),this._findWizardForm()?.removeEventListener("wf:nav-state",this._handleNavState)}_findWizardForm(){return this.closest("wizard-form")}_requestNavState(){this.dispatchEvent(new CustomEvent("wf:nav-state-request",{bubbles:!0,composed:!0}))}_dispatchNavEvent(){this.dispatchEvent(new CustomEvent(this._getEventName(),{bubbles:!0,composed:!0}))}}ke([mt()],Ee.prototype,"_isFirstStep"),ke([mt()],Ee.prototype,"_isLastStep"),ke([mt()],Ee.prototype,"_isSubmitting");const
|
|
1042
|
+
`)}return K`<div class="wf-progress" data-testid="wf-progress-bar" role="group" aria-label="Form progress">${t}</div>`}},t.WfProgress.styles=_e,xe([wt({type:String})],t.WfProgress.prototype,"for",2),xe([mt()],t.WfProgress.prototype,"_currentStep",2),xe([mt()],t.WfProgress.prototype,"_totalSteps",2),xe([mt()],t.WfProgress.prototype,"_isComplete",2),t.WfProgress=xe([ft("wf-progress")],t.WfProgress);var $e=Object.defineProperty,ke=(t,e,s,r)=>{for(var i,o=void 0,a=t.length-1;a>=0;a--)(i=t[a])&&(o=i(e,s,o)||o);return o&&$e(e,s,o),o};class Ee extends ct{constructor(){super(...arguments),this._isFirstStep=!0,this._isLastStep=!1,this._isSubmitting=!1,this._handleNavState=t=>{this._isFirstStep=t.detail.isFirstStep,this._isLastStep=t.detail.isLastStep,this._isSubmitting=t.detail.isSubmitting}}connectedCallback(){super.connectedCallback(),this._findWizardForm()?.addEventListener("wf:nav-state",this._handleNavState),this._requestNavState()}disconnectedCallback(){super.disconnectedCallback(),this._findWizardForm()?.removeEventListener("wf:nav-state",this._handleNavState)}_findWizardForm(){return this.closest("wizard-form")}_requestNavState(){this.dispatchEvent(new CustomEvent("wf:nav-state-request",{bubbles:!0,composed:!0}))}_dispatchNavEvent(){this.dispatchEvent(new CustomEvent(this._getEventName(),{bubbles:!0,composed:!0}))}}ke([mt()],Ee.prototype,"_isFirstStep"),ke([mt()],Ee.prototype,"_isLastStep"),ke([mt()],Ee.prototype,"_isSubmitting");const Ae=[_t,yt,c`
|
|
1043
1043
|
:host {
|
|
1044
1044
|
display: block;
|
|
1045
1045
|
width: 100%;
|
|
@@ -1092,7 +1092,7 @@
|
|
|
1092
1092
|
padding-left: 12px;
|
|
1093
1093
|
padding-right: 8px;
|
|
1094
1094
|
}
|
|
1095
|
-
`];var
|
|
1095
|
+
`];var Ce=Object.defineProperty,Oe=Object.getOwnPropertyDescriptor,We=(t,e,s,r)=>{for(var i,o=r>1?void 0:r?Oe(e,s):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,s,o):i(o))||o);return r&&o&&Ce(e,s,o),o};t.WfNextBtn=class extends Ee{constructor(){super(...arguments),this.showShortcut=!0,this.inline=!1,this.disabled=!1,this._handleClick=()=>{this.disabled||this._isSubmitting||this._dispatchNavEvent()}}_getEventName(){return"wf:nav-next"}_getButtonLabel(){return this.label?this.label:!this.inline&&("submit"===this.action||"next"!==this.action&&this._isLastStep)?"Submit":"Continue"}_isSubmitAction(){return!this.inline&&("submit"===this.action||"next"!==this.action&&this._isLastStep)}render(){const t=this._getButtonLabel(),e=this.disabled||this._isSubmitting;return K`
|
|
1096
1096
|
<button
|
|
1097
1097
|
type="button"
|
|
1098
1098
|
class="wf-btn wf-btn-next"
|
|
@@ -1109,7 +1109,7 @@
|
|
|
1109
1109
|
`:J}
|
|
1110
1110
|
`}
|
|
1111
1111
|
</button>
|
|
1112
|
-
`}},t.WfNextBtn.styles=
|
|
1112
|
+
`}},t.WfNextBtn.styles=Ae,We([wt({type:String})],t.WfNextBtn.prototype,"label",2),We([wt({type:String})],t.WfNextBtn.prototype,"action",2),We([wt({type:Boolean,attribute:"show-shortcut"})],t.WfNextBtn.prototype,"showShortcut",2),We([wt({type:Boolean})],t.WfNextBtn.prototype,"inline",2),We([wt({type:Boolean})],t.WfNextBtn.prototype,"disabled",2),t.WfNextBtn=We([ft("wf-next-btn")],t.WfNextBtn);const ze=[yt,c`
|
|
1113
1113
|
:host {
|
|
1114
1114
|
display: inline-block;
|
|
1115
1115
|
}
|