aw-wizard-forms 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/wizard-form.esm.js +25 -17
- package/dist/wizard-form.esm.js.map +1 -1
- package/dist/wizard-form.min.js +72 -72
- package/dist/wizard-form.min.js.map +1 -1
- package/package.json +1 -1
package/dist/wizard-form.min.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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 i(t){const{portalId:i,formId:s,fieldMapping:r={},mock:o=!1}=t;return{name:"hubspot",mapFields(t){const e={};for(const[i,s]of Object.entries(t))e[r[i]||i]=s;return e},async submit(t,r){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/${i}/${s}`,n=this.mapFields(t),h={fields:Object.entries(n).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:r.pageUrl,pageName:r.pageTitle,hutk:e()}};try{const t=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)});return t.ok?{success:!0,data:await t.json()}:{success:!1,error:(await t.json().catch(()=>({}))).message||"HubSpot submission failed: "+t.status}}catch(c){return{success:!1,error:c instanceof Error?c.message:"Network error"}}}}}function s(t){const{url:e,method:i="POST",headers:s={},fieldMapping:r={},mock:o=!1}=t;return{name:"webhook",mapFields(t){const e={};for(const[i,s]of Object.entries(t))e[r[i]||i]=s;return e},async submit(t,r){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:r.pageUrl,pageTitle:r.pageTitle,referrer:r.referrer,submittedAt:r.timestamp}};try{const t=await fetch(e,{method:i,headers:{"Content-Type":"application/json",...s},body:JSON.stringify(a)});if(!t.ok){const e=await t.text().catch(()=>"");return{success:!1,error:`Webhook failed: ${t.status} ${e}`.trim()}}let r;try{r=await t.json()}catch{r={status:t.status}}return{success:!0,data:r}}catch(n){return{success:!1,error:n instanceof Error?n.message:"Network error"}}}}}function r(){return"undefined"!=typeof window&&void 0!==window.RevenueHero}function o(t){const{routerId:e,fieldMapping:i={},mock:s=!1}=t;return{name:"revenuehero",mapFields(t){const e={};for(const[s,r]of Object.entries(t))e[i[s]||s]=r;return e},async submit(t,i){if(s)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(!r())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,h=Symbol(),c=new WeakMap;let l=class{constructor(t,e,i){if(this.i=!0,i!==h)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 i=void 0!==e&&1===e.length;i&&(t=c.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&c.set(e,t))}return t}toString(){return this.cssText}};const d=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new l("string"==typeof t?t:t+"",void 0,h))(e)})(t):t,{is:f,defineProperty:u,getOwnPropertyDescriptor:p,getOwnPropertyNames:w,getOwnPropertySymbols:b,getPrototypeOf:m}=Object,g=globalThis,v=g.trustedTypes,y=v?v.emptyScript:"",x=g.reactiveElementPolyfillSupport,$=(t,e)=>t,k={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 i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(s){i=null}}return i}},S=(t,e)=>!f(t,e),_={attribute:!0,type:String,converter:k,reflect:!1,useDefault:!1,hasChanged:S};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),g.litPropertyMetadata??(g.litPropertyMetadata=new WeakMap);let z=class extends HTMLElement{static addInitializer(t){this.m(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this.v&&[...this.v.keys()]}static createProperty(t,e=_){if(e.state&&(e.attribute=!1),this.m(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&u(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:r}=p(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const o=s?.call(this);r?.call(this,e),this.requestUpdate(t,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??_}static m(){if(this.hasOwnProperty($("elementProperties")))return;const t=m(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=!0,this.m(),this.hasOwnProperty($("properties"))){const t=this.properties,e=[...w(t),...b(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this.v=new Map;for(const[e,i]of this.elementProperties){const t=this.S(e,i);void 0!==t&&this.v.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(d(t))}else void 0!==t&&e.push(d(t));return e}static S(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this.A=null,this.P()}P(){this.N=new Promise(t=>this.enableUpdating=t),this.M=new Map,this.R(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this.I??(this.I=new Set)).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this.I?.delete(t)}R(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._=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 i of e){const e=document.createElement("style"),s=a.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=i.cssText,t.appendChild(e)}})(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this.I?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this.I?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this.q(t,i)}D(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor.S(t,i);if(void 0!==s&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:k).toAttribute(e,i.type);this.A=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this.A=null}}q(t,e){const i=this.constructor,s=i.v.get(t);if(void 0!==s&&this.A!==s){const t=i.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:k;this.A=s;const o=r.fromAttribute(e,t.type);this[s]=o??this.F?.get(s)??o,this.A=null}}requestUpdate(t,e,i,s=!1,r){if(void 0!==t){const o=this.constructor;if(!1===s&&(r=this[t]),i??(i=o.getPropertyOptions(t)),!((i.hasChanged??S)(r,e)||i.useDefault&&i.reflect&&r===this.F?.get(t)&&!this.hasAttribute(o.S(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this.N=this.V())}C(t,e,{useDefault:i,reflect:s,wrapped:r},o){i&&!(this.F??(this.F=new Map)).has(t)&&(this.F.set(t,o??e??this[t]),!0!==r||void 0!==o)||(this.M.has(t)||(this.hasUpdated||i||(e=void 0),this.M.set(t,e)),!0===s&&this.A!==t&&(this.B??(this.B=new Set)).add(t))}async V(){this.isUpdatePending=!0;try{await this.N}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._){for(const[t,e]of this._)this[t]=e;this._=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this.M.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this.M;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this.I?.forEach(t=>t.hostUpdate?.()),this.update(e)):this.U()}catch(i){throw t=!1,this.U(),i}t&&this.L(e)}willUpdate(t){}L(t){this.I?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}U(){this.M=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.N}shouldUpdate(t){return!0}update(t){this.B&&(this.B=this.B.forEach(t=>this.D(t,this[t]))),this.U()}updated(t){}firstUpdated(t){}};z.elementStyles=[],z.shadowRootOptions={mode:"open"},z[$("elementProperties")]=new Map,z[$("finalized")]=new Map,x?.({ReactiveElement:z}),(g.reactiveElementVersions??(g.reactiveElementVersions=[])).push("2.1.2");const E=globalThis,C=t=>t,O=E.trustedTypes,T=O?O.createPolicy("lit-html",{createHTML:t=>t}):void 0,j="$lit$",A=`lit$${Math.random().toFixed(9).slice(2)}$`,P="?"+A,N=`<${P}>`,M=document,R=()=>M.createComment(""),I=t=>null===t||"object"!=typeof t&&"function"!=typeof t,q=Array.isArray,D="[ \t\n\f\r]",F=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,V=/-->/g,B=/>/g,U=RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,H=/"/g,W=/^(?:script|style|textarea|title)$/i,Y=(t,...e)=>({H:1,strings:t,values:e}),J=Symbol.for("lit-noChange"),K=Symbol.for("lit-nothing"),X=new WeakMap,Z=M.createTreeWalker(M,129);function G(t,e){if(!q(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==T?T.createHTML(e):e}class Q{constructor({strings:t,H:e},i){let s;this.parts=[];let r=0,o=0;const a=t.length-1,n=this.parts,[h,c]=((t,e)=>{const i=t.length-1,s=[];let r,o=2===e?"<svg>":3===e?"<math>":"",a=F;for(let n=0;n<i;n++){const e=t[n];let i,h,c=-1,l=0;for(;l<e.length&&(a.lastIndex=l,h=a.exec(e),null!==h);)l=a.lastIndex,a===F?"!--"===h[1]?a=V:void 0!==h[1]?a=B:void 0!==h[2]?(W.test(h[2])&&(r=RegExp("</"+h[2],"g")),a=U):void 0!==h[3]&&(a=U):a===U?">"===h[0]?(a=r??F,c=-1):void 0===h[1]?c=-2:(c=a.lastIndex-h[2].length,i=h[1],a=void 0===h[3]?U:'"'===h[3]?H:L):a===H||a===L?a=U:a===V||a===B?a=F:(a=U,r=void 0);const d=a===U&&t[n+1].startsWith("/>")?" ":"";o+=a===F?e+N:c>=0?(s.push(i),e.slice(0,c)+j+e.slice(c)+A+d):e+A+(-2===c?n:d)}return[G(t,o+(t[i]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]})(t,e);if(this.el=Q.createElement(h,i),Z.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=Z.nextNode())&&n.length<a;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(j)){const e=c[o++],i=s.getAttribute(t).split(A),a=/([.?@])?(.*)/.exec(e);n.push({type:1,index:r,name:a[2],strings:i,ctor:"."===a[1]?rt:"?"===a[1]?ot:"@"===a[1]?at:st}),s.removeAttribute(t)}else t.startsWith(A)&&(n.push({type:6,index:r}),s.removeAttribute(t));if(W.test(s.tagName)){const t=s.textContent.split(A),e=t.length-1;if(e>0){s.textContent=O?O.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],R()),Z.nextNode(),n.push({type:2,index:++r});s.append(t[e],R())}}}else if(8===s.nodeType)if(s.data===P)n.push({type:2,index:r});else{let t=-1;for(;-1!==(t=s.data.indexOf(A,t+1));)n.push({type:7,index:r}),t+=A.length-1}r++}}static createElement(t,e){const i=M.createElement("template");return i.innerHTML=t,i}}function tt(t,e,i=t,s){if(e===J)return e;let r=void 0!==s?i.W?.[s]:i.Y;const o=I(e)?void 0:e.J;return r?.constructor!==o&&(r?.K?.(!1),void 0===o?r=void 0:(r=new o(t),r.X(t,i,s)),void 0!==s?(i.W??(i.W=[]))[s]=r:i.Y=r),void 0!==r&&(e=tt(t,r.Z(t,e.values),r,s)),e}class et{constructor(t,e){this.G=[],this.tt=void 0,this.et=t,this.it=e}get parentNode(){return this.it.parentNode}get st(){return this.it.st}u(t){const{el:{content:e},parts:i}=this.et,s=(t?.creationScope??M).importNode(e,!0);Z.currentNode=s;let r=Z.nextNode(),o=0,a=0,n=i[0];for(;void 0!==n;){if(o===n.index){let e;2===n.type?e=new it(r,r.nextSibling,this,t):1===n.type?e=new n.ctor(r,n.name,n.strings,this,t):6===n.type&&(e=new nt(r,this,t)),this.G.push(e),n=i[++a]}o!==n?.index&&(r=Z.nextNode(),o++)}return Z.currentNode=M,s}p(t){let e=0;for(const i of this.G)void 0!==i&&(void 0!==i.strings?(i.rt(t,i,e),e+=i.strings.length-2):i.rt(t[e])),e++}}class it{get st(){return this.it?.st??this.ot}constructor(t,e,i,s){this.type=2,this.nt=K,this.tt=void 0,this.ht=t,this.ct=e,this.it=i,this.options=s,this.ot=s?.isConnected??!0}get parentNode(){let t=this.ht.parentNode;const e=this.it;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this.ht}get endNode(){return this.ct}rt(t,e=this){t=tt(this,t,e),I(t)?t===K||null==t||""===t?(this.nt!==K&&this.lt(),this.nt=K):t!==this.nt&&t!==J&&this.dt(t):void 0!==t.H?this.$(t):void 0!==t.nodeType?this.T(t):(t=>q(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.k(t):this.dt(t)}O(t){return this.ht.parentNode.insertBefore(t,this.ct)}T(t){this.nt!==t&&(this.lt(),this.nt=this.O(t))}dt(t){this.nt!==K&&I(this.nt)?this.ht.nextSibling.data=t:this.T(M.createTextNode(t)),this.nt=t}$(t){const{values:e,H:i}=t,s="number"==typeof i?this.ft(t):(void 0===i.el&&(i.el=Q.createElement(G(i.h,i.h[0]),this.options)),i);if(this.nt?.et===s)this.nt.p(e);else{const t=new et(s,this),i=t.u(this.options);t.p(e),this.T(i),this.nt=t}}ft(t){let e=X.get(t.strings);return void 0===e&&X.set(t.strings,e=new Q(t)),e}k(t){q(this.nt)||(this.nt=[],this.lt());const e=this.nt;let i,s=0;for(const r of t)s===e.length?e.push(i=new it(this.O(R()),this.O(R()),this,this.options)):i=e[s],i.rt(r),s++;s<e.length&&(this.lt(i&&i.ct.nextSibling,s),e.length=s)}lt(t=this.ht.nextSibling,e){for(this.ut?.(!1,!0,e);t!==this.ct;){const e=C(t).nextSibling;C(t).remove(),t=e}}setConnected(t){void 0===this.it&&(this.ot=t,this.ut?.(t))}}class st{get tagName(){return this.element.tagName}get st(){return this.it.st}constructor(t,e,i,s,r){this.type=1,this.nt=K,this.tt=void 0,this.element=t,this.name=e,this.it=s,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this.nt=Array(i.length-1).fill(new String),this.strings=i):this.nt=K}rt(t,e=this,i,s){const r=this.strings;let o=!1;if(void 0===r)t=tt(this,t,e,0),o=!I(t)||t!==this.nt&&t!==J,o&&(this.nt=t);else{const s=t;let a,n;for(t=r[0],a=0;a<r.length-1;a++)n=tt(this,s[i+a],e,a),n===J&&(n=this.nt[a]),o||(o=!I(n)||n!==this.nt[a]),n===K?t=K:t!==K&&(t+=(n??"")+r[a+1]),this.nt[a]=n}o&&!s&&this.j(t)}j(t){t===K?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class rt extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===K?void 0:t}}class ot extends st{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==K)}}class at extends st{constructor(t,e,i,s,r){super(t,e,i,s,r),this.type=5}rt(t,e=this){if((t=tt(this,t,e,0)??K)===J)return;const i=this.nt,s=t===K&&i!==K||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,r=t!==K&&(i===K||s);s&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,t),this.nt=t}handleEvent(t){"function"==typeof this.nt?this.nt.call(this.options?.host??this.element,t):this.nt.handleEvent(t)}}class nt{constructor(t,e,i){this.element=t,this.type=6,this.tt=void 0,this.it=e,this.options=i}get st(){return this.it.st}rt(t){tt(this,t)}}const ht=E.litHtmlPolyfillSupport;ht?.(Q,it),(E.litHtmlVersions??(E.litHtmlVersions=[])).push("3.3.2");const ct=globalThis;class lt extends z{constructor(){super(...arguments),this.renderOptions={host:this},this.wt=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.wt=((t,e,i)=>{const s=i?.renderBefore??e;let r=s.bt;if(void 0===r){const t=i?.renderBefore??null;s.bt=r=new it(e.insertBefore(R(),t),t,void 0,i??{})}return r.rt(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.wt?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.wt?.setConnected(!1)}render(){return J}}lt.gt=!0,lt.finalized=!0,ct.litElementHydrateSupport?.({LitElement:lt});const dt=ct.litElementPolyfillSupport;dt?.({LitElement:lt}),(ct.litElementVersions??(ct.litElementVersions=[])).push("4.2.2");const ft=t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},ut={attribute:!0,type:String,converter:k,reflect:!1,hasChanged:S},pt=(t=ut,e,i)=>{const{kind:s,metadata:r}=i;let o=globalThis.litPropertyMetadata.get(r);if(void 0===o&&globalThis.litPropertyMetadata.set(r,o=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),o.set(i.name,t),"accessor"===s){const{name:s}=i;return{set(i){const r=e.get.call(this);e.set.call(this,i),this.requestUpdate(s,r,t,!0,i)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=i;return function(i){const r=this[s];e.call(this,i),this.requestUpdate(s,r,t,!0,i)}}throw Error("Unsupported decorator location: "+s)};function wt(t){return(e,i)=>"object"==typeof i?pt(t,e,i):((t,e,i)=>{const s=e.hasOwnProperty(i);return e.constructor.createProperty(i,t),s?Object.getOwnPropertyDescriptor(e,i):void 0})(t,e,i)}function bt(t){return wt({...t,state:!0,attribute:!1})}class mt{constructor(t){this.vt={},this.yt={},this.xt=1,this.$t=0,this.kt=!1,this.St=!1,this._t=new Map,this.zt=new Set,this.host=t,t.addController(this)}hostConnected(){}hostDisconnected(){this.zt.clear()}get formData(){return{...this.vt}}get validation(){return{...this.yt}}get currentStep(){return this.xt}get totalSteps(){return this.$t}get submitting(){return this.kt}get submitted(){return this.St}get error(){return this.Et}get state(){return{formData:this.formData,validation:this.validation,currentStep:this.xt,totalSteps:this.$t,submitting:this.kt,submitted:this.St,error:this.Et}}setValue(t,e){this.vt[t]=e,this.yt[t]?this.yt[t]={...this.yt[t],value:e,dirty:!0}:this.yt[t]={name:t,value:e,result:{valid:!0},touched:!1,dirty:!0},this.Ct()}getValue(t){return this.vt[t]}setValidation(t,e){const i=this.yt[t];this.yt[t]={name:t,value:i?.value??this.vt[t],result:e,touched:i?.touched??!1,dirty:i?.dirty??!1},this.Ct()}markTouched(t){this.yt[t]?this.yt[t]={...this.yt[t],touched:!0}:this.yt[t]={name:t,value:this.vt[t],result:{valid:!0},touched:!0,dirty:!1},this.Ct()}setTotalSteps(t){this.$t=t,this.Ct()}setStepConfig(t,e){this._t.set(t,e)}getStepConfig(t){return this._t.get(t)}getStepFields(t){return this._t.get(t)?.fields??[]}goToStep(t){if(t<1||t>this.$t)return!1;const e=this._t.get(t);return e?.skipIf?.(this.vt)?t>this.xt?this.goToStep(t+1):this.goToStep(t-1):(this.xt=t,this.Ct(),!0)}nextStep(){return this.goToStep(this.xt+1)}previousStep(){return this.goToStep(this.xt-1)}isFirstStep(){return 1===this.xt}isLastStep(){return this.xt===this.$t}isStepValid(t){return this.getStepFields(t).every(t=>{const e=this.yt[t];return!e||e.result.valid})}isCurrentStepValid(){return this.isStepValid(this.xt)}getFieldError(t){const e=this.yt[t];if(e?.touched&&!e.result.valid)return e.result.error}hasFieldError(t){return void 0!==this.getFieldError(t)}setSubmitting(t){this.kt=t,this.Ct()}setSubmitted(t){this.St=t,this.Ct()}setError(t){this.Et=t,this.Ct()}reset(){this.vt={},this.yt={},this.xt=1,this.kt=!1,this.St=!1,this.Et=void 0,this.Ct()}subscribe(t){return this.zt.add(t),()=>{this.zt.delete(t)}}Ct(){this.host.requestUpdate();const t=this.state;this.zt.forEach(e=>{try{e(t)}catch(i){}})}}class gt{constructor(t,e={}){this.Ot=!0,this.host=t,this.Tt={blockEnterOnTextarea:!0,...e},this.jt=this.At.bind(this),t.addController(this)}hostConnected(){this.host.addEventListener("keydown",this.jt),document.addEventListener("keydown",this.jt)}hostDisconnected(){this.host.removeEventListener("keydown",this.jt),document.removeEventListener("keydown",this.jt)}At(t){if(!this.Ot)return;const e=this.Pt(),i="TEXTAREA"===e?.tagName,s="INPUT"===e?.tagName,r="true"===e?.getAttribute("contenteditable"),o=i||s||r;switch(t.key){case"Enter":if(i&&this.Tt.blockEnterOnTextarea)return;this.Tt.onEnter&&(t.preventDefault(),this.Tt.onEnter());break;case"Escape":this.Tt.onEscape&&(t.preventDefault(),this.Tt.onEscape());break;case"ArrowUp":!o&&this.Tt.onArrowUp&&(t.preventDefault(),this.Tt.onArrowUp());break;case"ArrowDown":!o&&this.Tt.onArrowDown&&(t.preventDefault(),this.Tt.onArrowDown());break;case"ArrowLeft":!o&&this.Tt.onArrowLeft&&(t.preventDefault(),this.Tt.onArrowLeft());break;case"ArrowRight":!o&&this.Tt.onArrowRight&&(t.preventDefault(),this.Tt.onArrowRight())}}Pt(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}updateConfig(t){this.Tt={...this.Tt,...t}}enable(){this.Ot=!0}disable(){this.Ot=!1}get enabled(){return this.Ot}}var vt=Object.defineProperty,yt=Object.getOwnPropertyDescriptor,xt=(t,e,i,s)=>{for(var r,o=s>1?void 0:s?yt(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s?r(e,i,o):r(o))||o);return s&&o&&vt(e,i,o),o};t.WfBadge=class extends lt{constructor(){super(...arguments),this.shortcut="",this.variant="default"}createRenderRoot(){return this}render(){return Y`
|
|
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 r(t){const{portalId:r,formId:s,fieldMapping:i={},mock:o=!1}=t;return{name:"hubspot",mapFields(t){const e={};for(const[r,s]of Object.entries(t))e[i[r]||r]=s;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/${r}/${s}`,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 s(t){const{url:e,method:r="POST",headers:s={},fieldMapping:i={},mock:o=!1}=t;return{name:"webhook",mapFields(t){const e={};for(const[r,s]of Object.entries(t))e[i[r]||r]=s;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:r,headers:{"Content-Type":"application/json",...s},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:r={},mock:s=!1}=t;return{name:"revenuehero",mapFields(t){const e={};for(const[s,i]of Object.entries(t))e[r[s]||s]=i;return e},async submit(t,r){if(s)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,r){if(this._$cssResult$=!0,r!==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 r=void 0!==e&&1===e.length;r&&(t=d.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&d.set(e,t))}return t}toString(){return this.cssText}};const c=n?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const r of t.cssRules)e+=r.cssText;return(t=>new h("string"==typeof t?t:t+"",void 0,l))(e)})(t):t,{is:p,defineProperty:u,getOwnPropertyDescriptor:f,getOwnPropertyNames:m,getOwnPropertySymbols:w,getPrototypeOf:g}=Object,b=globalThis,_=b.trustedTypes,v=_?_.emptyScript:"",y=b.reactiveElementPolyfillSupport,x=(t,e)=>t,S={toAttribute(t,e){switch(e){case Boolean:t=t?v:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=null!==t;break;case Number:r=null===t?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch(s){r=null}}return r}},$=(t,e)=>!p(t,e),E={attribute:!0,type:String,converter:S,reflect:!1,useDefault:!1,hasChanged:$};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),b.litPropertyMetadata??(b.litPropertyMetadata=new WeakMap);let k=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 r=Symbol(),s=this.getPropertyDescriptor(t,r,e);void 0!==s&&u(this.prototype,t,s)}}static getPropertyDescriptor(t,e,r){const{get:s,set:i}=f(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const o=s?.call(this);i?.call(this,e),this.requestUpdate(t,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??E}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const t=g(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=[...m(t),...w(t)];for(const r of e)this.createProperty(r,t[r])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,r]of e)this.elementProperties.set(t,r)}this._$Eh=new Map;for(const[e,r]of this.elementProperties){const t=this._$Eu(e,r);void 0!==t&&this._$Eh.set(t,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const r=new Set(t.flat(1/0).reverse());for(const t of r)e.unshift(c(t))}else void 0!==t&&e.push(c(t));return e}static _$Eu(t,e){const r=e.attribute;return!1===r?void 0:"string"==typeof r?r:"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 r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);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 r of e){const e=document.createElement("style"),s=a.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=r.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,r){this._$AK(t,r)}_$ET(t,e){const r=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,r);if(void 0!==s&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:S).toAttribute(e,r.type);this._$Em=t,null==i?this.removeAttribute(s):this.setAttribute(s,i),this._$Em=null}}_$AK(t,e){const r=this.constructor,s=r._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=r.getPropertyOptions(s),i="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:S;this._$Em=s;const o=i.fromAttribute(e,t.type);this[s]=o??this._$Ej?.get(s)??o,this._$Em=null}}requestUpdate(t,e,r,s=!1,i){if(void 0!==t){const o=this.constructor;if(!1===s&&(i=this[t]),r??(r=o.getPropertyOptions(t)),!((r.hasChanged??$)(i,e)||r.useDefault&&r.reflect&&i===this._$Ej?.get(t)&&!this.hasAttribute(o._$Eu(t,r))))return;this.C(t,e,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:r,reflect:s,wrapped:i},o){r&&!(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||r||(e=void 0),this._$AL.set(t,e)),!0===s&&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,r]of t){const{wrapped:t}=r,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,r,s)}}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(r){throw t=!1,this._$EM(),r}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){}};k.elementStyles=[],k.shadowRootOptions={mode:"open"},k[x("elementProperties")]=new Map,k[x("finalized")]=new Map,y?.({ReactiveElement:k}),(b.reactiveElementVersions??(b.reactiveElementVersions=[])).push("2.1.2");const A=globalThis,C=t=>t,z=A.trustedTypes,O=z?z.createPolicy("lit-html",{createHTML:t=>t}):void 0,W="$lit$",P=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+P,D=`<${T}>`,M=document,L=()=>M.createComment(""),F=t=>null===t||"object"!=typeof t&&"function"!=typeof t,N=Array.isArray,I="[ \t\n\f\r]",q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,j=/-->/g,R=/>/g,V=RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),H=/'/g,U=/"/g,B=/^(?:script|style|textarea|title)$/i,Y=(t,...e)=>({_$litType$:1,strings:t,values:e}),K=Symbol.for("lit-noChange"),X=Symbol.for("lit-nothing"),J=new WeakMap,G=M.createTreeWalker(M,129);function Z(t,e){if(!N(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==O?O.createHTML(e):e}class Q{constructor({strings:t,_$litType$:e},r){let s;this.parts=[];let i=0,o=0;const a=t.length-1,n=this.parts,[l,d]=((t,e)=>{const r=t.length-1,s=[];let i,o=2===e?"<svg>":3===e?"<math>":"",a=q;for(let n=0;n<r;n++){const e=t[n];let r,l,d=-1,h=0;for(;h<e.length&&(a.lastIndex=h,l=a.exec(e),null!==l);)h=a.lastIndex,a===q?"!--"===l[1]?a=j:void 0!==l[1]?a=R:void 0!==l[2]?(B.test(l[2])&&(i=RegExp("</"+l[2],"g")),a=V):void 0!==l[3]&&(a=V):a===V?">"===l[0]?(a=i??q,d=-1):void 0===l[1]?d=-2:(d=a.lastIndex-l[2].length,r=l[1],a=void 0===l[3]?V:'"'===l[3]?U:H):a===U||a===H?a=V:a===j||a===R?a=q:(a=V,i=void 0);const c=a===V&&t[n+1].startsWith("/>")?" ":"";o+=a===q?e+D:d>=0?(s.push(r),e.slice(0,d)+W+e.slice(d)+P+c):e+P+(-2===d?n:c)}return[Z(t,o+(t[r]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]})(t,e);if(this.el=Q.createElement(l,r),G.currentNode=this.el.content,2===e||3===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(s=G.nextNode())&&n.length<a;){if(1===s.nodeType){if(s.hasAttributes())for(const t of s.getAttributeNames())if(t.endsWith(W)){const e=d[o++],r=s.getAttribute(t).split(P),a=/([.?@])?(.*)/.exec(e);n.push({type:1,index:i,name:a[2],strings:r,ctor:"."===a[1]?it:"?"===a[1]?ot:"@"===a[1]?at:st}),s.removeAttribute(t)}else t.startsWith(P)&&(n.push({type:6,index:i}),s.removeAttribute(t));if(B.test(s.tagName)){const t=s.textContent.split(P),e=t.length-1;if(e>0){s.textContent=z?z.emptyScript:"";for(let r=0;r<e;r++)s.append(t[r],L()),G.nextNode(),n.push({type:2,index:++i});s.append(t[e],L())}}}else if(8===s.nodeType)if(s.data===T)n.push({type:2,index:i});else{let t=-1;for(;-1!==(t=s.data.indexOf(P,t+1));)n.push({type:7,index:i}),t+=P.length-1}i++}}static createElement(t,e){const r=M.createElement("template");return r.innerHTML=t,r}}function tt(t,e,r=t,s){if(e===K)return e;let i=void 0!==s?r._$Co?.[s]:r._$Cl;const o=F(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,r,s)),void 0!==s?(r._$Co??(r._$Co=[]))[s]=i:r._$Cl=i),void 0!==i&&(e=tt(t,i._$AS(t,e.values),i,s)),e}class et{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:r}=this._$AD,s=(t?.creationScope??M).importNode(e,!0);G.currentNode=s;let i=G.nextNode(),o=0,a=0,n=r[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 nt(i,this,t)),this._$AV.push(e),n=r[++a]}o!==n?.index&&(i=G.nextNode(),o++)}return G.currentNode=M,s}p(t){let e=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}}class rt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,r,s){this.type=2,this._$AH=X,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=s,this._$Cv=s?.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=tt(this,t,e),F(t)?t===X||null==t||""===t?(this._$AH!==X&&this._$AR(),this._$AH=X):t!==this._$AH&&t!==K&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>N(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!==X&&F(this._$AH)?this._$AA.nextSibling.data=t:this.T(M.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:r}=t,s="number"==typeof r?this._$AC(t):(void 0===r.el&&(r.el=Q.createElement(Z(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new et(s,this),r=t.u(this.options);t.p(e),this.T(r),this._$AH=t}}_$AC(t){let e=J.get(t.strings);return void 0===e&&J.set(t.strings,e=new Q(t)),e}k(t){N(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let r,s=0;for(const i of t)s===e.length?e.push(r=new rt(this.O(L()),this.O(L()),this,this.options)):r=e[s],r._$AI(i),s++;s<e.length&&(this._$AR(r&&r._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){const e=C(t).nextSibling;C(t).remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class st{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,s,i){this.type=1,this._$AH=X,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=X}_$AI(t,e=this,r,s){const i=this.strings;let o=!1;if(void 0===i)t=tt(this,t,e,0),o=!F(t)||t!==this._$AH&&t!==K,o&&(this._$AH=t);else{const s=t;let a,n;for(t=i[0],a=0;a<i.length-1;a++)n=tt(this,s[r+a],e,a),n===K&&(n=this._$AH[a]),o||(o=!F(n)||n!==this._$AH[a]),n===X?t=X:t!==X&&(t+=(n??"")+i[a+1]),this._$AH[a]=n}o&&!s&&this.j(t)}j(t){t===X?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class it extends st{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===X?void 0:t}}class ot extends st{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==X)}}class at extends st{constructor(t,e,r,s,i){super(t,e,r,s,i),this.type=5}_$AI(t,e=this){if((t=tt(this,t,e,0)??X)===K)return;const r=this._$AH,s=t===X&&r!==X||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,i=t!==X&&(r===X||s);s&&this.element.removeEventListener(this.name,this,r),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 nt{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){tt(this,t)}}const lt=A.litHtmlPolyfillSupport;lt?.(Q,rt),(A.litHtmlVersions??(A.litHtmlVersions=[])).push("3.3.2");const dt=globalThis;class ht extends k{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,r)=>{const s=r?.renderBefore??e;let i=s._$litPart$;if(void 0===i){const t=r?.renderBefore??null;s._$litPart$=i=new rt(e.insertBefore(L(),t),t,void 0,r??{})}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 K}}ht._$litElement$=!0,ht.finalized=!0,dt.litElementHydrateSupport?.({LitElement:ht});const ct=dt.litElementPolyfillSupport;ct?.({LitElement:ht}),(dt.litElementVersions??(dt.litElementVersions=[])).push("4.2.2");const pt=t=>(e,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)},ut={attribute:!0,type:String,converter:S,reflect:!1,hasChanged:$},ft=(t=ut,e,r)=>{const{kind:s,metadata:i}=r;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),"setter"===s&&((t=Object.create(t)).wrapped=!0),o.set(r.name,t),"accessor"===s){const{name:s}=r;return{set(r){const i=e.get.call(this);e.set.call(this,r),this.requestUpdate(s,i,t,!0,r)},init(e){return void 0!==e&&this.C(s,void 0,t,e),e}}}if("setter"===s){const{name:s}=r;return function(r){const i=this[s];e.call(this,r),this.requestUpdate(s,i,t,!0,r)}}throw Error("Unsupported decorator location: "+s)};function mt(t){return(e,r)=>"object"==typeof r?ft(t,e,r):((t,e,r)=>{const s=e.hasOwnProperty(r);return e.constructor.createProperty(r,t),s?Object.getOwnPropertyDescriptor(e,r):void 0})(t,e,r)}function wt(t){return mt({...t,state:!0,attribute:!1})}class gt{constructor(t){this._formData={},this._validation={},this._currentStep=1,this._totalSteps=0,this._submitting=!1,this._submitted=!1,this._stepConfigs=new Map,this._subscribers=new Set,this.host=t,t.addController(this)}hostConnected(){}hostDisconnected(){this._subscribers.clear()}get formData(){return{...this._formData}}get validation(){return{...this._validation}}get currentStep(){return this._currentStep}get totalSteps(){return this._totalSteps}get submitting(){return this._submitting}get submitted(){return this._submitted}get error(){return this._error}get state(){return{formData:this.formData,validation:this.validation,currentStep:this._currentStep,totalSteps:this._totalSteps,submitting:this._submitting,submitted:this._submitted,error:this._error}}setValue(t,e){this._formData[t]=e,this._validation[t]?this._validation[t]={...this._validation[t],value:e,dirty:!0}:this._validation[t]={name:t,value:e,result:{valid:!0},touched:!1,dirty:!0},this._notifyChange()}getValue(t){return this._formData[t]}setValidation(t,e){const r=this._validation[t];this._validation[t]={name:t,value:r?.value??this._formData[t],result:e,touched:r?.touched??!1,dirty:r?.dirty??!1},this._notifyChange()}markTouched(t){this._validation[t]?this._validation[t]={...this._validation[t],touched:!0}:this._validation[t]={name:t,value:this._formData[t],result:{valid:!0},touched:!0,dirty:!1},this._notifyChange()}setTotalSteps(t){this._totalSteps=t,this._notifyChange()}setStepConfig(t,e){this._stepConfigs.set(t,e)}getStepConfig(t){return this._stepConfigs.get(t)}getStepFields(t){return this._stepConfigs.get(t)?.fields??[]}goToStep(t){if(t<1||t>this._totalSteps)return!1;const e=this._stepConfigs.get(t);return e?.skipIf?.(this._formData)?t>this._currentStep?this.goToStep(t+1):this.goToStep(t-1):(this._currentStep=t,this._notifyChange(),!0)}nextStep(){return this.goToStep(this._currentStep+1)}previousStep(){return this.goToStep(this._currentStep-1)}isFirstStep(){return 1===this._currentStep}isLastStep(){return this._currentStep===this._totalSteps}isStepValid(t){return this.getStepFields(t).every(t=>{const e=this._validation[t];return!e||e.result.valid})}isCurrentStepValid(){return this.isStepValid(this._currentStep)}getFieldError(t){const e=this._validation[t];if(e?.touched&&!e.result.valid)return e.result.error}hasFieldError(t){return void 0!==this.getFieldError(t)}setSubmitting(t){this._submitting=t,this._notifyChange()}setSubmitted(t){this._submitted=t,this._notifyChange()}setError(t){this._error=t,this._notifyChange()}reset(){this._formData={},this._validation={},this._currentStep=1,this._submitting=!1,this._submitted=!1,this._error=void 0,this._notifyChange()}subscribe(t){return this._subscribers.add(t),()=>{this._subscribers.delete(t)}}_notifyChange(){this.host.requestUpdate();const t=this.state;this._subscribers.forEach(e=>{try{e(t)}catch(r){}})}}class bt{constructor(t,e={}){this._enabled=!0,this.host=t,this._config={blockEnterOnTextarea:!0,...e},this._boundHandler=this._handleKeydown.bind(this),t.addController(this)}hostConnected(){this.host.addEventListener("keydown",this._boundHandler),document.addEventListener("keydown",this._boundHandler)}hostDisconnected(){this.host.removeEventListener("keydown",this._boundHandler),document.removeEventListener("keydown",this._boundHandler)}_handleKeydown(t){if(!this._enabled)return;const e=this._getActiveElement(),r="TEXTAREA"===e?.tagName,s="INPUT"===e?.tagName,i="true"===e?.getAttribute("contenteditable"),o=r||s||i;switch(t.key){case"Enter":if(r&&this._config.blockEnterOnTextarea)return;this._config.onEnter&&(t.preventDefault(),this._config.onEnter());break;case"Escape":this._config.onEscape&&(t.preventDefault(),this._config.onEscape());break;case"ArrowUp":!o&&this._config.onArrowUp&&(t.preventDefault(),this._config.onArrowUp());break;case"ArrowDown":!o&&this._config.onArrowDown&&(t.preventDefault(),this._config.onArrowDown());break;case"ArrowLeft":!o&&this._config.onArrowLeft&&(t.preventDefault(),this._config.onArrowLeft());break;case"ArrowRight":!o&&this._config.onArrowRight&&(t.preventDefault(),this._config.onArrowRight())}}_getActiveElement(){let t=document.activeElement;for(;t?.shadowRoot?.activeElement;)t=t.shadowRoot.activeElement;return t}updateConfig(t){this._config={...this._config,...t}}enable(){this._enabled=!0}disable(){this._enabled=!1}get enabled(){return this._enabled}}var _t=Object.defineProperty,vt=Object.getOwnPropertyDescriptor,yt=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?vt(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&_t(e,r,o),o};t.WfBadge=class extends ht{constructor(){super(...arguments),this.shortcut="",this.variant="default"}createRenderRoot(){return this}render(){return Y`
|
|
2
2
|
<span
|
|
3
3
|
class="wf-badge wf-badge--${this.variant}"
|
|
4
4
|
aria-hidden="true"
|
|
5
5
|
>
|
|
6
6
|
${this.shortcut}
|
|
7
7
|
</span>
|
|
8
|
-
`}},
|
|
8
|
+
`}},yt([mt({type:String})],t.WfBadge.prototype,"shortcut",2),yt([mt({type:String})],t.WfBadge.prototype,"variant",2),t.WfBadge=yt([pt("wf-badge")],t.WfBadge);var xt=Object.defineProperty,St=Object.getOwnPropertyDescriptor,$t=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?St(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&xt(e,r,o),o};t.WizardForm=class extends ht{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._steps=[],this._currentStep=1,this._totalSteps=0,this._formData={},this._submitting=!1,this._submitted=!1,this._error="",this._cachedSuccessContent=null,this._stateController=new gt(this),this._handleFieldChange=t=>{const{name:e,value:r,extraFields:s}=t.detail;this._formData[e]=r,this._stateController.setValue(e,r),s&&Object.entries(s).forEach(([t,e])=>{this._formData[t]=e,this._stateController.setValue(t,e)}),this._error="",this.dispatchEvent(new CustomEvent("wf:field-change",{detail:{name:e,value:r,formData:{...this._formData}},bubbles:!0,composed:!0}))},this._handleOptionSelect=t=>{if(this.autoAdvance){const e=t.target.closest("wf-options");e&&!e.hasAttribute("multi")&&setTimeout(()=>{this._goNext()},300)}},new bt(this,{onEnter:()=>this._handleEnter(),onEscape:()=>this._handleEscape()})}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.addEventListener("wf-change",this._handleFieldChange),this.addEventListener("wf-option-select",this._handleOptionSelect)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("wf-change",this._handleFieldChange),this.removeEventListener("wf-option-select",this._handleOptionSelect)}firstUpdated(){this._cachedSuccessContent=this.querySelector('[slot="success"]'),this._discoverSteps(),this._showCurrentStep()}render(){return this._submitted?(this._steps.forEach(t=>{t.active=!1,t.style.display="none"}),this._cachedSuccessContent?(this._cachedSuccessContent.style.display="",Y`
|
|
9
9
|
<div class="wf-container wf-submitted">
|
|
10
10
|
<div class="wf-success-screen">
|
|
11
|
-
${this.
|
|
11
|
+
${this._cachedSuccessContent}
|
|
12
12
|
</div>
|
|
13
13
|
</div>
|
|
14
14
|
`):Y`
|
|
@@ -18,43 +18,43 @@
|
|
|
18
18
|
<p>Your submission has been received.</p>
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
21
|
-
`):(this.
|
|
21
|
+
`):(this._cachedSuccessContent&&(this._cachedSuccessContent.style.display="none"),Y`
|
|
22
22
|
<div class="wf-container">
|
|
23
|
-
${this.
|
|
23
|
+
${this._error?Y`<div class="wf-form-error" role="alert">${this._error}</div>`:X}
|
|
24
24
|
|
|
25
|
-
${this.
|
|
25
|
+
${this._renderNavigation()}
|
|
26
26
|
</div>
|
|
27
|
-
`)}
|
|
27
|
+
`)}_renderProgress(){const t=[];for(let e=1;e<=this._totalSteps;e++){const r=e<this._currentStep,s=e===this._currentStep;t.push(Y`
|
|
28
28
|
<div
|
|
29
|
-
class="wf-progress-segment ${
|
|
29
|
+
class="wf-progress-segment ${r?"completed":""} ${s?"active":""}"
|
|
30
30
|
></div>
|
|
31
|
-
`)}return Y`<div class="wf-progress">${t}</div>`}
|
|
31
|
+
`)}return Y`<div class="wf-progress">${t}</div>`}_renderNavigation(){const t=1===this._currentStep,e=this._currentStep===this._totalSteps,r=!this.hideBack&&!t;return Y`
|
|
32
32
|
<div class="wf-navigation">
|
|
33
|
-
${
|
|
33
|
+
${r?Y`
|
|
34
34
|
<button
|
|
35
35
|
class="wf-btn wf-btn-back"
|
|
36
|
-
@click="${this.
|
|
37
|
-
?disabled="${this.
|
|
36
|
+
@click="${this._goBack}"
|
|
37
|
+
?disabled="${this._submitting}"
|
|
38
38
|
data-testid="wf-back-btn"
|
|
39
39
|
>
|
|
40
40
|
<span class="wf-btn-shortcut"><wf-badge shortcut="Esc" variant="button-secondary"></wf-badge></span>
|
|
41
41
|
Back
|
|
42
42
|
</button>
|
|
43
|
-
`:
|
|
43
|
+
`:X}
|
|
44
44
|
|
|
45
45
|
<button
|
|
46
46
|
class="wf-btn wf-btn-next"
|
|
47
|
-
@click="${this.
|
|
48
|
-
?disabled="${this.
|
|
47
|
+
@click="${this._goNext}"
|
|
48
|
+
?disabled="${this._submitting}"
|
|
49
49
|
data-testid="wf-next-btn"
|
|
50
50
|
>
|
|
51
|
-
${this.
|
|
51
|
+
${this._submitting?Y`<span class="wf-loading"></span>`:e?"Submit":"Continue"}
|
|
52
52
|
<span class="wf-btn-shortcut"><wf-badge shortcut="Enter ↵" variant="button"></wf-badge></span>
|
|
53
53
|
</button>
|
|
54
54
|
</div>
|
|
55
|
-
`}
|
|
55
|
+
`}_discoverSteps(){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]}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 r=this._getStepByNumber(t);if(!r)return;if(r.shouldSkip(this._formData)){const r="forward"===e?t+1:t-1;return r>=1&&r<=this._totalSteps?this._navigateToStep(r,e):void 0}const s=this._currentStep;let i,o=!1;if(this.submitOnStep&&this.hubspotPortal&&this.hubspotForm)try{await this._submitPartialToHubSpot(),o=!0,i="hubspot"}catch(n){return void this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:n instanceof Error?n.message:"Partial submission failed",formData:this._getFieldsUpToStep(this._currentStep)},bubbles:!0,composed:!0}))}const a=this._getStepByNumber(this._currentStep);a&&await a.hide(),this._currentStep=t,this._stateController.goToStep(t),r.show(e),this.dispatchEvent(new CustomEvent("wf:step-change",{detail:{from:s,to:t,direction:e,submitted:o,adapter:i},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="";let r=t;this.serialize&&(r=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(r):{success:!0},this._submitted=!0,this.dispatchEvent(new CustomEvent("wf:success",{detail:{formData:r,response:t},bubbles:!0,composed:!0}))}catch(s){const t=s instanceof Error?s.message:"Submission failed";this._error=t,this.dispatchEvent(new CustomEvent("wf:error",{detail:{error:t,formData:r},bubbles:!0,composed:!0}))}finally{this._submitting=!1}}async _submitToHubSpot(t){const e=`https://api.hsforms.com/submissions/v3/integration/submit/${this.hubspotPortal}/${this.hubspotForm}`,r={fields:Object.entries(t).map(([t,e])=>({name:t,value:Array.isArray(e)?e.join(";"):(e??"")+""})),context:{pageUri:window.location.href,pageName:document.title}},s=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!s.ok){const t=await s.json().catch(()=>({}));throw Error(t.message||"HubSpot submission failed: "+s.status)}return s.json()}_getFieldsUpToStep(t){const e={};for(let r=0;r<t&&r<this._steps.length;r++)this._steps[r].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)),await this._submitToHubSpot(t)}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([mt({type:String,attribute:"hubspot-portal"})],t.WizardForm.prototype,"hubspotPortal",2),$t([mt({type:String,attribute:"hubspot-form"})],t.WizardForm.prototype,"hubspotForm",2),$t([mt({type:String,reflect:!0})],t.WizardForm.prototype,"theme",2),$t([mt({type:Boolean})],t.WizardForm.prototype,"mock",2),$t([mt({type:Boolean,attribute:"show-progress"})],t.WizardForm.prototype,"showProgress",2),$t([mt({type:Boolean,attribute:"auto-advance"})],t.WizardForm.prototype,"autoAdvance",2),$t([mt({type:Boolean,attribute:"hide-back"})],t.WizardForm.prototype,"hideBack",2),$t([mt({attribute:!1})],t.WizardForm.prototype,"serialize",2),$t([mt({type:Boolean,attribute:"submit-on-step"})],t.WizardForm.prototype,"submitOnStep",2),$t([wt()],t.WizardForm.prototype,"_steps",2),$t([wt()],t.WizardForm.prototype,"_currentStep",2),$t([wt()],t.WizardForm.prototype,"_totalSteps",2),$t([wt()],t.WizardForm.prototype,"_formData",2),$t([wt()],t.WizardForm.prototype,"_submitting",2),$t([wt()],t.WizardForm.prototype,"_submitted",2),$t([wt()],t.WizardForm.prototype,"_error",2),t.WizardForm=$t([pt("wizard-form")],t.WizardForm),t.WfSuccess=class extends ht{createRenderRoot(){return this}render(){return Y``}},t.WfSuccess=$t([pt("wf-success")],t.WfSuccess);var Et=Object.defineProperty,kt=Object.getOwnPropertyDescriptor,At=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?kt(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Et(e,r,o),o};t.WfStep=class extends ht{constructor(){super(...arguments),this.step=0,this.active=!1,this.direction="forward",this.leaving=!1,this.skipIf="",this._fields=[]}createRenderRoot(){return this}render(){return Y`
|
|
56
56
|
<div class="wf-step-content"></div>
|
|
57
|
-
`}firstUpdated(){this.
|
|
57
|
+
`}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"],e=[],r=s=>{if(t.includes(s.tagName.toLowerCase())){const t=s.getAttribute("name");t&&e.push(t)}Array.from(s.children).forEach(r)};Array.from(this.children).forEach(r),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"].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[r,s]=e.split("===").map(t=>t.trim());return t[r]===s.replace(/['"]/g,"")}if(e.includes("!==")){const[r,s]=e.split("!==").map(t=>t.trim());return t[r]!==s.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 r=async s=>{"validate"in s&&"function"==typeof s.validate&&(await s.validate()||(t.push(s),e=!1));for(const t of s.children)await r(t)};for(const s of this.children)await r(s);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}},At([mt({type:Number,attribute:"data-step"})],t.WfStep.prototype,"step",2),At([mt({type:Boolean,reflect:!0})],t.WfStep.prototype,"active",2),At([mt({type:String,reflect:!0})],t.WfStep.prototype,"direction",2),At([mt({type:Boolean,reflect:!0})],t.WfStep.prototype,"leaving",2),At([mt({type:String,attribute:"data-skip-if"})],t.WfStep.prototype,"skipIf",2),At([wt()],t.WfStep.prototype,"_fields",2),t.WfStep=At([pt("wf-step")],t.WfStep);var Ct=Object.defineProperty,zt=Object.getOwnPropertyDescriptor,Ot=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?zt(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Ct(e,r,o),o};const Wt={none:0,xs:4,sm:8,md:16,lg:24,xl:32};t.WfLayout=class extends ht{constructor(){super(...arguments),this.mode="flex",this.direction="column",this.gap="none",this.gapX="",this.gapY="",this.align="stretch",this.justify="start",this.padding="none",this.paddingX="",this.paddingY="",this.wrap=!1,this.width="full",this.columns="auto",this.minItemWidth="200px"}createRenderRoot(){return this}_resolveSpacing(t){if(!t||"none"===t)return"0";if(t in Wt)return Wt[t]+"px";const e=parseFloat(t);return isNaN(e)?t:e+"px"}_getGapX(){return this._resolveSpacing(this.gapX||this.gap)}_getGapY(){return this._resolveSpacing(this.gapY||this.gap)}_getPadding(){const t=this._resolveSpacing(this.padding),e=this.paddingX?this._resolveSpacing(this.paddingX):t;return`${this.paddingY?this._resolveSpacing(this.paddingY):t} ${e}`}_buildStyles(){const t=[];if("grid"===this.mode){t.push("display: grid");const e=parseInt(this.columns,10);!isNaN(e)&&e>0?t.push(`grid-template-columns: repeat(${e}, 1fr)`):t.push(`grid-template-columns: repeat(auto-fit, minmax(${this.minItemWidth}, 1fr))`),"stretch"!==this.align&&t.push("align-items: "+this.align),"start"!==this.justify&&t.push("justify-content: "+this.justify)}else t.push("display: flex"),t.push("flex-direction: "+this.direction),this.wrap&&t.push("flex-wrap: wrap"),"stretch"!==this.align&&t.push("align-items: "+this.align),"start"!==this.justify&&t.push("justify-content: "+this.justify);const e=this._getGapX(),r=this._getGapY();"0"===e&&"0"===r||(t.push("column-gap: "+e),t.push("row-gap: "+r));const s=this._getPadding();return"0 0"!==s&&t.push("padding: "+s),t.join("; ")}updated(t){super.updated(t),this.style.cssText=this._buildStyles(),this.classList.remove("wf-layout--width-full","wf-layout--width-auto","wf-layout--width-fit"),this.classList.add("wf-layout--width-"+this.width)}render(){return Y``}},Ot([mt({type:String})],t.WfLayout.prototype,"mode",2),Ot([mt({type:String})],t.WfLayout.prototype,"direction",2),Ot([mt({type:String})],t.WfLayout.prototype,"gap",2),Ot([mt({type:String,attribute:"gap-x"})],t.WfLayout.prototype,"gapX",2),Ot([mt({type:String,attribute:"gap-y"})],t.WfLayout.prototype,"gapY",2),Ot([mt({type:String})],t.WfLayout.prototype,"align",2),Ot([mt({type:String})],t.WfLayout.prototype,"justify",2),Ot([mt({type:String})],t.WfLayout.prototype,"padding",2),Ot([mt({type:String,attribute:"padding-x"})],t.WfLayout.prototype,"paddingX",2),Ot([mt({type:String,attribute:"padding-y"})],t.WfLayout.prototype,"paddingY",2),Ot([mt({type:Boolean})],t.WfLayout.prototype,"wrap",2),Ot([mt({type:String})],t.WfLayout.prototype,"width",2),Ot([mt({type:String})],t.WfLayout.prototype,"columns",2),Ot([mt({type:String,attribute:"min-item-width"})],t.WfLayout.prototype,"minItemWidth",2),t.WfLayout=Ot([pt("wf-layout")],t.WfLayout);var Pt=Object.defineProperty,Tt=Object.getOwnPropertyDescriptor,Dt=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?Tt(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Pt(e,r,o),o};t.WfOptions=class extends ht{constructor(){super(...arguments),this.name="",this.multi=!1,this.required=!1,this.min=0,this.max=0,this.columns=2,this.allowOther=!1,this.otherLabel="Other, please specify:",this.otherPlaceholder="Enter your answer",this.otherRequired=!1,this.otherName="",this.otherFieldValue="Others",this._selected=new Set,this._otherValue="",this._errorMessage="",this._validationActivated=!1,this._options=[],this._shortcutMap=new Map,this._otherShortcut="",this._handleOptionSelect=t=>{t.stopPropagation();const{value:e}=t.detail;this._selectValue(e)},this._handleKeydown=t=>{const e=this.closest("wf-step");if(!e||!e.hasAttribute("active"))return;const r=t.composedPath()[0];if("INPUT"===r?.tagName||"TEXTAREA"===r?.tagName)return;const s=this.querySelector(".wf-other-input");if(s&&document.activeElement===s)return;const i=t.key.toUpperCase();if(1===i.length&&i>="A"&&i<="Z"){if(this.allowOther&&i===this._otherShortcut){t.preventDefault();const e=this.querySelector(".wf-other-input");return void(e&&e.focus())}const e=this._shortcutMap.get(i);e&&!e.disabled&&(t.preventDefault(),e.triggerSelect())}}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._errorMessage="",this._validationActivated=!1,this.addEventListener("wf-option-select",this._handleOptionSelect),document.addEventListener("keydown",this._handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("wf-option-select",this._handleOptionSelect),document.removeEventListener("keydown",this._handleKeydown)}firstUpdated(){const t=this.querySelector("wf-layout");Array.from(this.querySelectorAll(":scope > wf-option")).forEach(e=>t?.appendChild(e)),this._discoverOptions(),this.requestUpdate()}updated(t){(t.has("multi")||t.has("max"))&&this._updateOptionStates()}render(){return this.setAttribute("role","listbox"),this.setAttribute("aria-multiselectable",this.multi+""),this.setAttribute("aria-required",this.required+""),Y`
|
|
58
58
|
<wf-layout mode="grid" columns="${this.columns}" gap="md">
|
|
59
59
|
<!-- wf-option children will be moved here in firstUpdated -->
|
|
60
60
|
</wf-layout>
|
|
@@ -62,41 +62,41 @@
|
|
|
62
62
|
<div class="wf-other-container">
|
|
63
63
|
<label class="wf-other-label">${this.otherLabel}</label>
|
|
64
64
|
<div class="wf-other-input-wrapper">
|
|
65
|
-
${this.
|
|
65
|
+
${this._otherShortcut?Y`<wf-badge shortcut="${this._otherShortcut}"></wf-badge>`:""}
|
|
66
66
|
<input
|
|
67
67
|
type="text"
|
|
68
68
|
class="wf-other-input"
|
|
69
|
-
.value="${this.
|
|
69
|
+
.value="${this._otherValue}"
|
|
70
70
|
placeholder="${this.otherPlaceholder}"
|
|
71
71
|
data-testid="wf-other-input"
|
|
72
|
-
@input="${this.
|
|
73
|
-
@keydown="${this.
|
|
74
|
-
@focus="${this.
|
|
72
|
+
@input="${this._handleOtherInput}"
|
|
73
|
+
@keydown="${this._handleOtherKeydown}"
|
|
74
|
+
@focus="${this._handleOtherFocus}"
|
|
75
75
|
/>
|
|
76
76
|
</div>
|
|
77
77
|
</div>
|
|
78
78
|
`:""}
|
|
79
79
|
<span class="wf-error-message" role="alert" aria-live="polite" data-testid="wf-error">
|
|
80
|
-
${this.
|
|
80
|
+
${this._errorMessage}
|
|
81
81
|
</span>
|
|
82
|
-
`}
|
|
82
|
+
`}_handleOtherInput(t){const e=t.target;this._otherValue=e.value,this._otherValue.trim()&&this._selected.size>0&&(this._selected.clear(),this._updateOptionStates()),this._dispatchChange()}_handleOtherFocus(){}_handleOtherKeydown(t){"Escape"===t.key&&(t.stopPropagation(),t.target.blur())}_discoverOptions(){const t=this.querySelector("wf-layout");this._options=t?Array.from(t.querySelectorAll(":scope > wf-option")):[],this._shortcutMap.clear(),this._options.forEach((t,e)=>{if(e<26){const r=String.fromCharCode(65+e);t.shortcut=r,this._shortcutMap.set(r,t)}t.setSelected(this._selected.has(t.value))}),this.allowOther&&this._options.length<26&&(this._otherShortcut=String.fromCharCode(65+this._options.length))}_selectValue(t){this.multi?this._handleMultiSelect(t):this._handleSingleSelect(t),this.allowOther&&this._otherValue&&(this._otherValue=""),this._updateOptionStates(),this._validateSelection(),this._dispatchChange()}_handleSingleSelect(t){this._selected.clear(),this._selected.add(t)}_handleMultiSelect(t){if(this._selected.has(t))this._selected.delete(t);else{if(this.max>0&&this._selected.size>=this.max)return;this._selected.add(t)}}_updateOptionStates(){this._options.forEach(t=>{t.setSelected(this._selected.has(t.value))})}_checkValidation(){const t=this.allowOther&&this._otherValue.trim(),e=this._selected.size>0||t;if(this.required&&!e)return!1;if(this.multi){if(this.min>0&&this._selected.size<this.min&&!t)return!1;if(this.max>0&&this._selected.size>this.max)return!1}return!0}_validateSelection(){if(!this._validationActivated)return this._errorMessage="",this._checkValidation();this._errorMessage="";const t=this.allowOther&&this._otherValue.trim(),e=this._selected.size>0||t;if(this.required&&!e)return this._errorMessage=this.allowOther?"Please select an option or specify in the text field":"Please select an option",!1;if(this.multi){if(this.min>0&&this._selected.size<this.min&&!t)return this._errorMessage=`Please select at least ${this.min} option${this.min>1?"s":""}`,!1;if(this.max>0&&this._selected.size>this.max)return this._errorMessage=`Please select at most ${this.max} option${this.max>1?"s":""}`,!1}return!0}_dispatchChange(){const t=Array.from(this._selected),e=this.allowOther&&this._otherValue.trim()&&0===this._selected.size;let r;r=this.otherName&&e?this.multi?[this.otherFieldValue]:this.otherFieldValue:this.value;const s={name:this.name,value:r,selected:t};this.otherName&&(s.extraFields={[this.otherName]:e?this._otherValue.trim():""}),this.dispatchEvent(new CustomEvent("wf-change",{detail:s,bubbles:!0,composed:!0}))}get value(){if(this.allowOther&&this._otherValue.trim()&&0===this._selected.size)return this.multi?[this._otherValue]:this._otherValue;const t=Array.from(this._selected);return this.multi?t:t[0]??""}set value(t){this._selected.clear(),Array.isArray(t)?t.forEach(t=>this._selected.add(t)):t&&this._selected.add(t),this._updateOptionStates(),this._validateSelection()}getSelected(){return Array.from(this._selected)}isSelected(t){return this._selected.has(t)}select(t){this._selectValue(t)}deselect(t){this._selected.has(t)&&(this._selected.delete(t),this._updateOptionStates(),this._validateSelection(),this._dispatchChange())}clear(){this._selected.clear(),this._updateOptionStates(),this._validateSelection(),this._dispatchChange()}validate(){return this._validationActivated=!0,this._validateSelection()}get isValid(){return this._checkValidation()}showError(t){this._errorMessage=t}clearError(){this._errorMessage=""}focus(){this._options[0]?.focus()}reset(){this._selected.clear(),this._otherValue="",this._errorMessage="",this._validationActivated=!1,this._options.forEach(t=>{t.hasAttribute("selected")&&this._selected.add(t.value),t.setSelected(this._selected.has(t.value))}),this._dispatchChange()}},Dt([mt({type:String})],t.WfOptions.prototype,"name",2),Dt([mt({type:Boolean})],t.WfOptions.prototype,"multi",2),Dt([mt({type:Boolean})],t.WfOptions.prototype,"required",2),Dt([mt({type:Number})],t.WfOptions.prototype,"min",2),Dt([mt({type:Number})],t.WfOptions.prototype,"max",2),Dt([mt({type:Number,reflect:!0})],t.WfOptions.prototype,"columns",2),Dt([mt({type:Boolean,attribute:"allow-other"})],t.WfOptions.prototype,"allowOther",2),Dt([mt({type:String,attribute:"other-label"})],t.WfOptions.prototype,"otherLabel",2),Dt([mt({type:String,attribute:"other-placeholder"})],t.WfOptions.prototype,"otherPlaceholder",2),Dt([mt({type:Boolean,attribute:"other-required"})],t.WfOptions.prototype,"otherRequired",2),Dt([mt({type:String,attribute:"other-name"})],t.WfOptions.prototype,"otherName",2),Dt([mt({type:String,attribute:"other-value"})],t.WfOptions.prototype,"otherFieldValue",2),Dt([wt()],t.WfOptions.prototype,"_selected",2),Dt([wt()],t.WfOptions.prototype,"_otherValue",2),Dt([wt()],t.WfOptions.prototype,"_errorMessage",2),Dt([wt()],t.WfOptions.prototype,"_otherShortcut",2),t.WfOptions=Dt([pt("wf-options")],t.WfOptions);var Mt=Object.defineProperty,Lt=Object.getOwnPropertyDescriptor,Ft=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?Lt(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Mt(e,r,o),o};t.WfOption=class extends ht{constructor(){super(...arguments),this.value="",this.selected=!1,this.disabled=!1,this.shortcut="",this._selecting=!1,this._cachedContent=[]}createRenderRoot(){return this}connectedCallback(){0===this._cachedContent.length&&(this._cachedContent=Array.from(this.childNodes).map(t=>t.cloneNode(!0)),this.textContent=""),super.connectedCallback()}render(){return Y`
|
|
83
83
|
<button
|
|
84
|
-
class="wf-option-card ${this.
|
|
84
|
+
class="wf-option-card ${this._selecting?"selecting":""}"
|
|
85
85
|
role="option"
|
|
86
86
|
aria-selected="${this.selected}"
|
|
87
87
|
?disabled="${this.disabled}"
|
|
88
88
|
data-testid="wf-option-btn"
|
|
89
|
-
@click="${this.
|
|
89
|
+
@click="${this._handleClick}"
|
|
90
90
|
>
|
|
91
91
|
${this.shortcut?Y`<wf-badge
|
|
92
92
|
shortcut="${this.shortcut}"
|
|
93
93
|
variant="${this.selected?"selected":"default"}"
|
|
94
|
-
></wf-badge>`:
|
|
94
|
+
></wf-badge>`:X}
|
|
95
95
|
<div class="wf-option-content">
|
|
96
|
-
${this.
|
|
96
|
+
${this._cachedContent}
|
|
97
97
|
</div>
|
|
98
98
|
</button>
|
|
99
|
-
`}
|
|
99
|
+
`}_handleClick(t){this.disabled?t.preventDefault():this._triggerSelect()}triggerSelect(){this.disabled||this._triggerSelect()}_triggerSelect(){this._selecting=!0;const t={value:this.value,selected:!this.selected};this.dispatchEvent(new CustomEvent("wf-option-select",{detail:t,bubbles:!0,composed:!0})),setTimeout(()=>{this._selecting=!1},300)}focus(){const t=this.querySelector("button");t?.focus()}setSelected(t){this.selected=t}},Ft([mt({type:String})],t.WfOption.prototype,"value",2),Ft([mt({type:Boolean,reflect:!0})],t.WfOption.prototype,"selected",2),Ft([mt({type:Boolean,reflect:!0})],t.WfOption.prototype,"disabled",2),Ft([mt({type:String})],t.WfOption.prototype,"shortcut",2),Ft([wt()],t.WfOption.prototype,"_selecting",2),t.WfOption=Ft([pt("wf-option")],t.WfOption);var Nt=Object.defineProperty,It=(t,e,r,s)=>{for(var i,o=void 0,a=t.length-1;a>=0;a--)(i=t[a])&&(o=i(e,r,o)||o);return o&&Nt(e,r,o),o};class qt extends ht{constructor(){super(...arguments),this.name="",this.label="",this.required=!1,this.hint="",this._errorMessage="",this._value="",this._validationActivated=!1,this._debounceTimer=null,this._validators=[],this._handleInput=t=>{const e=t.target;this._value=e.value,this._validationActivated&&(this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{this.validate()},this._getDebounceMs())),this.dispatchEvent(new CustomEvent("wf-change",{detail:{name:this.name,value:this._value},bubbles:!0,composed:!0}))},this._handleBlur=()=>{this.dispatchEvent(new CustomEvent("wf-blur",{detail:{name:this.name,value:this._value},bubbles:!0,composed:!0}))},this._handleFocus=()=>{this.dispatchEvent(new CustomEvent("wf-focus",{detail:{name:this.name},bubbles:!0,composed:!0}))}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._setupValidators()}updated(t){this._getValidationTriggerProperties().some(e=>t.has(e))&&this._setupValidators()}_getDebounceMs(){return 600}_getFocusableSelector(){return"input"}get value(){return this._value}set value(t){this._value=t}addValidator(t){this._validators.push(t)}async validate(){this._validationActivated=!0;const t=this.value;for(const r of this._validators)try{const e=await r.validate(t);if(!e.valid)return this._errorMessage=e.error??r.message??"Validation failed",!1}catch(e){return this._errorMessage="Validation error occurred",!1}return this._errorMessage="",!0}get isValid(){const t=this.value;for(const e of this._validators){const r=e.validate(t);if(!(r instanceof Promise||r.valid))return!1}return!0}showError(t){this._errorMessage=t}clearError(){this._errorMessage=""}focus(){const t=this.querySelector(this._getFocusableSelector());t?.focus()}reset(){this._value="",this._errorMessage="",this._validationActivated=!1,this._debounceTimer&&(clearTimeout(this._debounceTimer),this._debounceTimer=null)}}It([mt({type:String})],qt.prototype,"name"),It([mt({type:String})],qt.prototype,"label"),It([mt({type:Boolean})],qt.prototype,"required"),It([mt({type:String})],qt.prototype,"hint"),It([wt()],qt.prototype,"_errorMessage"),It([wt()],qt.prototype,"_value");const jt=["gmail.com","yahoo.com","hotmail.com","outlook.com","aol.com","icloud.com","mail.com","protonmail.com","zoho.com","yandex.com","live.com","msn.com","me.com","inbox.com","gmx.com"];class Rt{constructor(t){this._validators=new Map,this.host=t,t.addController(this)}hostConnected(){}hostDisconnected(){this._validators.clear()}addValidator(t,e){const r=this._validators.get(t)??[];this._validators.set(t,[...r,e])}addValidators(t,e){e.forEach(e=>this.addValidator(t,e))}removeValidator(t,e){const r=this._validators.get(t)??[];this._validators.set(t,r.filter(t=>t.name!==e))}clearValidators(t){this._validators.delete(t)}getValidators(t){return this._validators.get(t)??[]}async validate(t,e){const r=this.getValidators(t);for(const i of r)try{const t=await i.validate(e);if(!t.valid)return{valid:!1,error:t.error??i.message??"Validation failed"}}catch(s){return{valid:!1,error:"Validation error occurred"}}return{valid:!0}}validateSync(t,e){const r=this.getValidators(t);for(const s of r){const t=s.validate(e);if(!(t instanceof Promise||t.valid))return{valid:!1,error:t.error??s.message??"Validation failed"}}return{valid:!0}}static required(t="This field is required"){return{name:"required",message:t,validate:e=>null==e||"string"==typeof e&&""===e.trim()||Array.isArray(e)&&0===e.length?{valid:!1,error:t}:{valid:!0}}}static email(t="Please enter a valid email address"){const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return{name:"email",message:t,validate:r=>"string"!=typeof r||""===r.trim()||e.test(r)?{valid:!0}:{valid:!1,error:t}}}static workEmail(t=jt,e="Please use your work email address"){return{name:"workEmail",message:e,validate:r=>{if("string"!=typeof r||""===r.trim())return{valid:!0};const s=r.split("@")[1]?.toLowerCase();return s&&t.includes(s)?{valid:!1,error:e}:{valid:!0}}}}static pattern(t,e="Invalid format"){return{name:"pattern",message:e,validate:r=>"string"!=typeof r||""===r.trim()||t.test(r)?{valid:!0}:{valid:!1,error:e}}}static minLength(t,e){const r=e??`Minimum ${t} characters required`;return{name:"minLength",message:r,validate:e=>"string"!=typeof e?{valid:!0}:e.length<t?{valid:!1,error:r}:{valid:!0}}}static maxLength(t,e){const r=e??`Maximum ${t} characters allowed`;return{name:"maxLength",message:r,validate:e=>"string"!=typeof e?{valid:!0}:e.length>t?{valid:!1,error:r}:{valid:!0}}}static minSelections(t,e){const r=e??`Select at least ${t} option${t>1?"s":""}`;return{name:"minSelections",message:r,validate:e=>Array.isArray(e)&&e.length<t?{valid:!1,error:r}:{valid:!0}}}static maxSelections(t,e){const r=e??`Select at most ${t} option${t>1?"s":""}`;return{name:"maxSelections",message:r,validate:e=>Array.isArray(e)&&e.length>t?{valid:!1,error:r}:{valid:!0}}}static custom(t,e,r){return{name:t,message:r,validate:e}}}var Vt=Object.defineProperty,Ht=Object.getOwnPropertyDescriptor,Ut=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?Ht(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Vt(e,r,o),o};t.WfField=class extends qt{constructor(){super(...arguments),this._inputElement=null}connectedCallback(){super.connectedCallback(),this.addEventListener("input",this._handleInput),this.addEventListener("blur",this._handleBlur,!0),this.addEventListener("focus",this._handleFocus,!0)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("input",this._handleInput),this.removeEventListener("blur",this._handleBlur,!0),this.removeEventListener("focus",this._handleFocus,!0)}firstUpdated(){this._discoverInput(),this._setupValidators()}_getValidationTriggerProperties(){return["required"]}_getDebounceMs(){return 300}_setupValidators(){if(!this._inputElement)return;if(this._validators=[],(this.required||this._inputElement.hasAttribute("required"))&&this._validators.push(Rt.required()),"email"===this._inputElement.getAttribute("type")&&this._validators.push(Rt.email()),this._inputElement.hasAttribute("data-work-email")){const t=this._inputElement.getAttribute("data-blocked-domains"),e=t?t.split(",").map(t=>t.trim()):void 0;this._validators.push(Rt.workEmail(e))}const t=this._inputElement.getAttribute("pattern");if(t){const e=this._inputElement.getAttribute("data-pattern-message")||"Invalid format";this._validators.push(Rt.pattern(RegExp(t),e))}const e=this._inputElement.getAttribute("minlength");e&&this._validators.push(Rt.minLength(parseInt(e,10)));const r=this._inputElement.getAttribute("maxlength");r&&this._validators.push(Rt.maxLength(parseInt(r,10)))}_handleSlotChange(){this._discoverInput(),this._setupValidators()}_discoverInput(){const t=this.shadowRoot?.querySelector("slot");if(!t)return;const e=t.assignedElements({flatten:!0});for(const r of e)if(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement){this._inputElement=r,r.id||(r.id=this.name),r.name||(r.name=this.name),this._value=r.value;break}}get value(){return this._inputElement?.value??this._value}set value(t){this._value=t,this._inputElement&&(this._inputElement.value=(t??"")+"")}focus(){this._inputElement?.focus()}reset(){super.reset(),this._inputElement&&(this._inputElement.value="")}render(){return Y`
|
|
100
100
|
<div class="wf-field-container">
|
|
101
101
|
${this.label?Y`<label
|
|
102
102
|
class="wf-label ${this.required?"wf-label-required":""}"
|
|
@@ -105,14 +105,14 @@
|
|
|
105
105
|
${this.label}
|
|
106
106
|
</label>`:""}
|
|
107
107
|
<div class="wf-input-wrapper">
|
|
108
|
-
<slot @slotchange="${this.
|
|
108
|
+
<slot @slotchange="${this._handleSlotChange}"></slot>
|
|
109
109
|
</div>
|
|
110
|
-
${this.hint&&!this.
|
|
110
|
+
${this.hint&&!this._errorMessage?Y`<span class="wf-hint">${this.hint}</span>`:""}
|
|
111
111
|
<span class="wf-error-message" role="alert" aria-live="polite">
|
|
112
|
-
${this.
|
|
112
|
+
${this._errorMessage}
|
|
113
113
|
</span>
|
|
114
114
|
</div>
|
|
115
|
-
`}},
|
|
115
|
+
`}},Ut([wt()],t.WfField.prototype,"_inputElement",2),t.WfField=Ut([pt("wf-field")],t.WfField);var Bt=Object.defineProperty,Yt=Object.getOwnPropertyDescriptor,Kt=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?Yt(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Bt(e,r,o),o};t.WfEmail=class extends qt{constructor(){super(...arguments),this.placeholder="you@company.com",this.workEmail=!1,this.blockedDomains="",this.workEmailMessage="Please use your work email address",this.disabled=!1}_getValidationTriggerProperties(){return["required","workEmail","blockedDomains"]}_getDebounceMs(){return 300}_setupValidators(){if(this._validators=[],this.required&&this._validators.push(Rt.required()),this._validators.push(Rt.email()),this.workEmail){let t=jt;this.blockedDomains&&(t=this.blockedDomains.split(",").map(t=>t.trim().toLowerCase())),this._validators.push(Rt.workEmail(t,this.workEmailMessage))}}render(){return Y`
|
|
116
116
|
<div class="wf-field-container">
|
|
117
117
|
${this.label?Y`<label
|
|
118
118
|
class="wf-label ${this.required?"wf-label-required":""}"
|
|
@@ -123,24 +123,24 @@
|
|
|
123
123
|
</label>`:""}
|
|
124
124
|
<input
|
|
125
125
|
type="email"
|
|
126
|
-
class="wf-input ${this.
|
|
126
|
+
class="wf-input ${this._errorMessage?"wf-input-error":""}"
|
|
127
127
|
id="${this.name}"
|
|
128
128
|
name="${this.name}"
|
|
129
129
|
placeholder="${this.placeholder}"
|
|
130
|
-
.value="${this.
|
|
130
|
+
.value="${this._value}"
|
|
131
131
|
?disabled="${this.disabled}"
|
|
132
132
|
?required="${this.required}"
|
|
133
133
|
data-testid="wf-input"
|
|
134
|
-
@input="${this.
|
|
135
|
-
@blur="${this.
|
|
136
|
-
@focus="${this.
|
|
134
|
+
@input="${this._handleInput}"
|
|
135
|
+
@blur="${this._handleBlur}"
|
|
136
|
+
@focus="${this._handleFocus}"
|
|
137
137
|
/>
|
|
138
|
-
${this.hint&&!this.
|
|
138
|
+
${this.hint&&!this._errorMessage?Y`<span class="wf-hint">${this.hint}</span>`:""}
|
|
139
139
|
<span class="wf-error-message" role="alert" aria-live="polite" data-testid="wf-error">
|
|
140
|
-
${this.
|
|
140
|
+
${this._errorMessage}
|
|
141
141
|
</span>
|
|
142
142
|
</div>
|
|
143
|
-
`}},
|
|
143
|
+
`}},Kt([mt({type:String})],t.WfEmail.prototype,"placeholder",2),Kt([mt({type:Boolean,attribute:"work-email"})],t.WfEmail.prototype,"workEmail",2),Kt([mt({type:String,attribute:"blocked-domains"})],t.WfEmail.prototype,"blockedDomains",2),Kt([mt({type:String,attribute:"work-email-message"})],t.WfEmail.prototype,"workEmailMessage",2),Kt([mt({type:Boolean})],t.WfEmail.prototype,"disabled",2),t.WfEmail=Kt([pt("wf-email")],t.WfEmail);var Xt=Object.defineProperty,Jt=Object.getOwnPropertyDescriptor,Gt=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?Jt(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Xt(e,r,o),o};t.WfInput=class extends qt{constructor(){super(...arguments),this.placeholder="",this.type="text",this.patternMessage="Invalid format",this.disabled=!1,this.autocomplete=""}_getValidationTriggerProperties(){return["required","minlength","maxlength","pattern"]}_setupValidators(){this._validators=[],this.required&&this._validators.push(Rt.required()),void 0!==this.minlength&&this._validators.push(Rt.minLength(this.minlength)),void 0!==this.maxlength&&this._validators.push(Rt.maxLength(this.maxlength)),this.pattern&&this._validators.push(Rt.pattern(RegExp(this.pattern),this.patternMessage))}render(){return Y`
|
|
144
144
|
<div class="wf-field-container">
|
|
145
145
|
${this.label?Y`<label
|
|
146
146
|
class="wf-label ${this.required?"wf-label-required":""}"
|
|
@@ -151,25 +151,25 @@
|
|
|
151
151
|
</label>`:""}
|
|
152
152
|
<input
|
|
153
153
|
type="${this.type}"
|
|
154
|
-
class="wf-input ${this.
|
|
154
|
+
class="wf-input ${this._errorMessage?"wf-input-error":""}"
|
|
155
155
|
id="${this.name}"
|
|
156
156
|
name="${this.name}"
|
|
157
157
|
placeholder="${this.placeholder}"
|
|
158
|
-
.value="${this.
|
|
158
|
+
.value="${this._value}"
|
|
159
159
|
?disabled="${this.disabled}"
|
|
160
160
|
?required="${this.required}"
|
|
161
161
|
autocomplete="${this.autocomplete||"off"}"
|
|
162
162
|
data-testid="wf-input"
|
|
163
|
-
@input="${this.
|
|
164
|
-
@blur="${this.
|
|
165
|
-
@focus="${this.
|
|
163
|
+
@input="${this._handleInput}"
|
|
164
|
+
@blur="${this._handleBlur}"
|
|
165
|
+
@focus="${this._handleFocus}"
|
|
166
166
|
/>
|
|
167
|
-
${this.hint&&!this.
|
|
167
|
+
${this.hint&&!this._errorMessage?Y`<span class="wf-hint">${this.hint}</span>`:""}
|
|
168
168
|
<span class="wf-error-message" role="alert" aria-live="polite" data-testid="wf-error">
|
|
169
|
-
${this.
|
|
169
|
+
${this._errorMessage}
|
|
170
170
|
</span>
|
|
171
171
|
</div>
|
|
172
|
-
`}},
|
|
172
|
+
`}},Gt([mt({type:String})],t.WfInput.prototype,"placeholder",2),Gt([mt({type:String})],t.WfInput.prototype,"type",2),Gt([mt({type:Number})],t.WfInput.prototype,"minlength",2),Gt([mt({type:Number})],t.WfInput.prototype,"maxlength",2),Gt([mt({type:String})],t.WfInput.prototype,"pattern",2),Gt([mt({type:String,attribute:"pattern-message"})],t.WfInput.prototype,"patternMessage",2),Gt([mt({type:Boolean})],t.WfInput.prototype,"disabled",2),Gt([mt({type:String})],t.WfInput.prototype,"autocomplete",2),t.WfInput=Gt([pt("wf-input")],t.WfInput);var Zt=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,te=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?Qt(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Zt(e,r,o),o};t.WfNumber=class extends t.WfInput{constructor(){super(...arguments),this.step=1}_setupValidators(){this._validators=[],this.required&&this._validators.push(Rt.required()),void 0===this.min&&void 0===this.max||this._validators.push(Rt.custom("range",t=>{if(""===t||null==t)return{valid:!0};const e=Number(t);return isNaN(e)?{valid:!1,error:"Please enter a valid number"}:void 0!==this.min&&e<this.min?{valid:!1,error:"Value must be at least "+this.min}:void 0!==this.max&&e>this.max?{valid:!1,error:"Value must be at most "+this.max}:{valid:!0}},"Value out of range"))}render(){return Y`
|
|
173
173
|
<div class="wf-field-container">
|
|
174
174
|
${this.label?Y`<label
|
|
175
175
|
class="wf-label ${this.required?"wf-label-required":""}"
|
|
@@ -180,11 +180,11 @@
|
|
|
180
180
|
</label>`:""}
|
|
181
181
|
<input
|
|
182
182
|
type="number"
|
|
183
|
-
class="wf-input ${this.
|
|
183
|
+
class="wf-input ${this._errorMessage?"wf-input-error":""}"
|
|
184
184
|
id="${this.name}"
|
|
185
185
|
name="${this.name}"
|
|
186
186
|
placeholder="${this.placeholder}"
|
|
187
|
-
.value="${this.
|
|
187
|
+
.value="${this._value}"
|
|
188
188
|
?disabled="${this.disabled}"
|
|
189
189
|
?required="${this.required}"
|
|
190
190
|
min="${this.min??""}"
|
|
@@ -192,16 +192,16 @@
|
|
|
192
192
|
step="${this.step}"
|
|
193
193
|
autocomplete="${this.autocomplete||"off"}"
|
|
194
194
|
data-testid="wf-input"
|
|
195
|
-
@input="${this.
|
|
196
|
-
@blur="${this.
|
|
197
|
-
@focus="${this.
|
|
195
|
+
@input="${this._handleInput}"
|
|
196
|
+
@blur="${this._handleBlur}"
|
|
197
|
+
@focus="${this._handleFocus}"
|
|
198
198
|
/>
|
|
199
|
-
${this.hint&&!this.
|
|
199
|
+
${this.hint&&!this._errorMessage?Y`<span class="wf-hint">${this.hint}</span>`:""}
|
|
200
200
|
<span class="wf-error-message" role="alert" aria-live="polite" data-testid="wf-error">
|
|
201
|
-
${this.
|
|
201
|
+
${this._errorMessage}
|
|
202
202
|
</span>
|
|
203
203
|
</div>
|
|
204
|
-
`}get valueAsNumber(){return Number(this.
|
|
204
|
+
`}get valueAsNumber(){return Number(this._value)||0}set valueAsNumber(t){this._value=t+""}},te([mt({type:Number})],t.WfNumber.prototype,"min",2),te([mt({type:Number})],t.WfNumber.prototype,"max",2),te([mt({type:Number})],t.WfNumber.prototype,"step",2),t.WfNumber=te([pt("wf-number")],t.WfNumber);var ee=Object.defineProperty,re=Object.getOwnPropertyDescriptor,se=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?re(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&ee(e,r,o),o};function ie(t){const e="string"==typeof t.container?document.querySelector(t.container):t.container;if(!e)throw Error("[WizardForm] Container not found: "+t.container);let i=e.querySelector("wizard-form");if(!i&&(i=e,"wizard-form"!==i.tagName.toLowerCase()))throw Error("[WizardForm] Container must be a <wizard-form> element or contain one");t.theme&&i.setAttribute("theme",t.theme),void 0!==t.showProgress&&(i.showProgress=t.showProgress),void 0!==t.autoAdvance&&(i.autoAdvance=t.autoAdvance),t.mock&&(i.mock=t.mock);let a=null;if("object"==typeof t.adapter)a=t.adapter;else switch(t.adapter||"json"){case"hubspot":if(!t.hubspot?.portalId||!t.hubspot?.formId)throw Error("[WizardForm] HubSpot config requires portalId and formId");a=r({portalId:t.hubspot.portalId,formId:t.hubspot.formId,fieldMapping:t.hubspot.fieldMapping,mock:t.mock}),i.setAttribute("hubspot-portal",t.hubspot.portalId),i.setAttribute("hubspot-form",t.hubspot.formId);break;case"webhook":if(!t.webhook?.url)throw Error("[WizardForm] Webhook config requires url");a=s({url:t.webhook.url,method:t.webhook.method,headers:t.webhook.headers,fieldMapping:t.webhook.fieldMapping,mock:t.mock});break;case"revenuehero":if(!t.revenuehero?.routerId)throw Error("[WizardForm] RevenueHero config requires routerId");a=o({routerId:t.revenuehero.routerId,fieldMapping:t.revenuehero.fieldMapping,mock:t.mock});break;case"json":a=null}const n=e=>{const r=e.detail.formData;let s={...r};if(t.serialize&&(s=t.serialize(s)),t.mock&&(window.__wizardFormData=s,window.__wizardFormRawData=r,window.__wizardFormInstance=p),t.onSubmit&&!1===t.onSubmit(s))e.preventDefault();else if(a){e.preventDefault();const o={pageUrl:window.location.href,pageTitle:document.title,referrer:document.referrer,timestamp:(new Date).toISOString()};a.submit(s,o).then(e=>{t.mock&&(window.__wizardFormResponse=e),e.success?(i._submitted=!0,i.requestUpdate(),i.dispatchEvent(new CustomEvent("wf:success",{detail:{formData:r,response:e.data},bubbles:!0,composed:!0}))):(t.mock&&(window.__wizardFormError=e.error),t.onError&&t.onError(e.error||"Submission failed",r))})}},l=e=>{t.mock&&(window.__wizardFormResponse={success:!0,data:e.detail.response}),t.onSuccess&&t.onSuccess(e.detail.formData,e.detail.response)},d=e=>{t.mock&&(window.__wizardFormError=e.detail.error),t.onError&&t.onError(e.detail.error,e.detail.formData)},h=e=>{t.onStepChange&&t.onStepChange(e.detail.from,e.detail.to,e.detail.direction)},c=e=>{t.onFieldChange&&t.onFieldChange(e.detail.name,e.detail.value,e.detail.formData)};i.addEventListener("wf:submit",n),i.addEventListener("wf:success",l),i.addEventListener("wf:error",d),i.addEventListener("wf:step-change",h),i.addEventListener("wf:field-change",c);const p={element:i,get formData(){return i.formData},get currentStep(){return i.currentStep},get totalSteps(){return i.totalSteps},next:()=>i.next(),back(){i.back()},goToStep(t){i.goToStep(t)},submit:()=>i.submit(),reset(){i.reset()},setFormData(t){i.setFormData(t)},destroy(){i.removeEventListener("wf:submit",n),i.removeEventListener("wf:success",l),i.removeEventListener("wf:error",d),i.removeEventListener("wf:step-change",h),i.removeEventListener("wf:field-change",c)},serialize:t.serialize};return p}t.WfTextarea=class extends qt{constructor(){super(...arguments),this.placeholder="",this.rows=4,this.disabled=!1,this.showCount=!1,this._handleKeydown=t=>{"Enter"===t.key&&t.stopPropagation()}}_getValidationTriggerProperties(){return["required","minlength","maxlength"]}_getFocusableSelector(){return"textarea"}_setupValidators(){this._validators=[],this.required&&this._validators.push(Rt.required()),void 0!==this.minlength&&this._validators.push(Rt.minLength(this.minlength)),void 0!==this.maxlength&&this._validators.push(Rt.maxLength(this.maxlength))}render(){const t=this._value.length,e=void 0!==this.maxlength&&t>=this.maxlength;return Y`
|
|
205
205
|
<div class="wf-field-container">
|
|
206
206
|
${this.label?Y`<label
|
|
207
207
|
class="wf-label ${this.required?"wf-label-required":""}"
|
|
@@ -211,38 +211,38 @@
|
|
|
211
211
|
${this.label}
|
|
212
212
|
</label>`:""}
|
|
213
213
|
<textarea
|
|
214
|
-
class="wf-textarea ${this.
|
|
214
|
+
class="wf-textarea ${this._errorMessage?"wf-textarea-error":""}"
|
|
215
215
|
id="${this.name}"
|
|
216
216
|
name="${this.name}"
|
|
217
217
|
placeholder="${this.placeholder}"
|
|
218
218
|
rows="${this.rows}"
|
|
219
|
-
.value="${this.
|
|
219
|
+
.value="${this._value}"
|
|
220
220
|
?disabled="${this.disabled}"
|
|
221
221
|
?required="${this.required}"
|
|
222
222
|
maxlength="${this.maxlength??""}"
|
|
223
223
|
data-testid="wf-textarea"
|
|
224
|
-
@input="${this.
|
|
225
|
-
@blur="${this.
|
|
226
|
-
@focus="${this.
|
|
227
|
-
@keydown="${this.
|
|
224
|
+
@input="${this._handleInput}"
|
|
225
|
+
@blur="${this._handleBlur}"
|
|
226
|
+
@focus="${this._handleFocus}"
|
|
227
|
+
@keydown="${this._handleKeydown}"
|
|
228
228
|
></textarea>
|
|
229
229
|
${this.showCount&&this.maxlength?Y`<span class="wf-char-count ${e?"wf-char-limit":""}" data-testid="wf-counter">
|
|
230
230
|
${t}/${this.maxlength}
|
|
231
231
|
</span>`:""}
|
|
232
|
-
${this.hint&&!this.
|
|
232
|
+
${this.hint&&!this._errorMessage?Y`<span class="wf-hint">${this.hint}</span>`:""}
|
|
233
233
|
<span class="wf-error-message" role="alert" aria-live="polite" data-testid="wf-error">
|
|
234
|
-
${this.
|
|
234
|
+
${this._errorMessage}
|
|
235
235
|
</span>
|
|
236
236
|
</div>
|
|
237
|
-
`}},se([
|
|
237
|
+
`}},se([mt({type:String})],t.WfTextarea.prototype,"placeholder",2),se([mt({type:Number})],t.WfTextarea.prototype,"rows",2),se([mt({type:Number})],t.WfTextarea.prototype,"minlength",2),se([mt({type:Number})],t.WfTextarea.prototype,"maxlength",2),se([mt({type:Boolean})],t.WfTextarea.prototype,"disabled",2),se([mt({type:Boolean,attribute:"show-count"})],t.WfTextarea.prototype,"showCount",2),t.WfTextarea=se([pt("wf-textarea")],t.WfTextarea);const oe={init:ie};var ae=Object.defineProperty,ne=Object.getOwnPropertyDescriptor,le=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?ne(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&ae(e,r,o),o};t.WfProgress=class extends ht{constructor(){super(...arguments),this.for="",this._currentStep=1,this._totalSteps=1,this._isComplete=!1,this._wizard=null,this._boundHandleStepChange=this._handleStepChange.bind(this),this._boundHandleSuccess=this._handleSuccess.bind(this),this._boundHandleStepsDiscovered=this._handleStepsDiscovered.bind(this)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),document.addEventListener("wf:steps-discovered",this._boundHandleStepsDiscovered),requestAnimationFrame(()=>{this._connectToWizard()})}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("wf:steps-discovered",this._boundHandleStepsDiscovered),this._disconnectFromWizard()}_connectToWizard(){this.for?this._wizard=document.getElementById(this.for):this._wizard=this.closest("wizard-form"),this._wizard&&(this._currentStep=this._wizard.currentStep||1,this._totalSteps=this._wizard.totalSteps||1,this._isComplete=this._wizard.isSubmitted||!1,this._wizard.addEventListener("wf:step-change",this._boundHandleStepChange),this._wizard.addEventListener("wf:success",this._boundHandleSuccess))}_disconnectFromWizard(){this._wizard&&(this._wizard.removeEventListener("wf:step-change",this._boundHandleStepChange),this._wizard.removeEventListener("wf:success",this._boundHandleSuccess),this._wizard=null)}_handleStepChange(t){this._currentStep=t.detail.to,this._wizard&&(this._totalSteps=this._wizard.totalSteps)}_handleStepsDiscovered(t){const{wizard:e,wizardId:r,totalSteps:s,currentStep:i}=t.detail;if(this.for){if(r!==this.for)return}else{const t=this.closest("wizard-form");if(!t||t!==e)return}!this._wizard&&e&&(this._wizard=e,e.addEventListener("wf:step-change",this._boundHandleStepChange),e.addEventListener("wf:success",this._boundHandleSuccess)),this._totalSteps=s,this._currentStep=i}_handleSuccess(){this._isComplete=!0}render(){if(this._isComplete)return null;const t=[];for(let e=1;e<=this._totalSteps;e++){const r=e<this._currentStep,s=e===this._currentStep;t.push(Y`
|
|
238
238
|
<div
|
|
239
|
-
class="wf-progress-segment ${
|
|
239
|
+
class="wf-progress-segment ${r?"completed":""} ${s?"active":""}"
|
|
240
240
|
role="progressbar"
|
|
241
|
-
aria-valuenow="${this.
|
|
241
|
+
aria-valuenow="${this._currentStep}"
|
|
242
242
|
aria-valuemin="1"
|
|
243
|
-
aria-valuemax="${this
|
|
243
|
+
aria-valuemax="${this._totalSteps}"
|
|
244
244
|
></div>
|
|
245
|
-
`)}return Y`<div class="wf-progress" role="group" aria-label="Form progress">${t}</div>`}},
|
|
245
|
+
`)}return Y`<div class="wf-progress" role="group" aria-label="Form progress">${t}</div>`}},le([mt({type:String})],t.WfProgress.prototype,"for",2),le([wt()],t.WfProgress.prototype,"_currentStep",2),le([wt()],t.WfProgress.prototype,"_totalSteps",2),le([wt()],t.WfProgress.prototype,"_isComplete",2),t.WfProgress=le([pt("wf-progress")],t.WfProgress);var de=Object.defineProperty,he=Object.getOwnPropertyDescriptor,ce=(t,e,r,s)=>{for(var i,o=s>1?void 0:s?he(e,r):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&de(e,r,o),o};t.WfThankYou=class extends ht{constructor(){super(...arguments),this.title="Thank you!",this.subtitle="We've received your request.",this.hideIcon=!1}createRenderRoot(){return this}render(){return Y`
|
|
246
246
|
${this.hideIcon?"":Y`
|
|
247
247
|
<div class="wf-thank-you-icon">
|
|
248
248
|
<slot name="icon">
|
|
@@ -266,5 +266,5 @@
|
|
|
266
266
|
<p class="wf-thank-you-subtitle">${this.subtitle}</p>
|
|
267
267
|
<slot></slot>
|
|
268
268
|
<slot name="footer"></slot>
|
|
269
|
-
`}},de([wt({type:String})],t.WfThankYou.prototype,"title",2),de([wt({type:String})],t.WfThankYou.prototype,"subtitle",2),de([wt({type:Boolean,attribute:"hide-icon"})],t.WfThankYou.prototype,"hideIcon",2),t.WfThankYou=de([ft("wf-thank-you")],t.WfThankYou),function(){if("undefined"==typeof document)return;const t="wf-global-styles";if(document.getElementById(t))return;const e=document.createElement("style");e.id=t,e.textContent='wizard-form{--wf-color-primary:#8040f0;--wf-color-primary-border:#602cbb;--wf-color-primary-light:#8040f014;--wf-color-surface:#f3f3f5;--wf-color-surface-hover:#e9e9eb;--wf-color-border:#d4d4d4;--wf-color-text:#0a0a0a;--wf-color-text-secondary:#404040;--wf-color-text-muted:#646464;--wf-color-error:#dc3545;--wf-color-badge-bg:#fcfcfc;--wf-color-badge-border:#d4d4d4;--wf-color-badge-text:#5f5f5f;--wf-color-progress-active:#8b8b8b99;--wf-color-progress-inactive:#d9d9d999;--wf-spacing-1:4px;--wf-spacing-2:8px;--wf-spacing-3:12px;--wf-spacing-4:16px;--wf-spacing-5:20px;--wf-spacing-6:24px;--wf-spacing-8:32px;--wf-radius-sm:4px;--wf-radius-md:8px;--wf-radius-lg:8px;--wf-radius-full:99px;--wf-font-size-xs:.75rem;--wf-font-size-sm:.875rem;--wf-font-size-base:1rem;--wf-font-size-lg:1.25rem;--wf-font-size-xl:1.5rem;--wf-font-size-2xl:2rem;--wf-font-size-3xl:2.5rem;--wf-input-min-height:56px;--wf-glass-bg:#ffffffb3;--wf-glass-bg-hover:#ffffffd9;--wf-glass-border:#0000001a;--wf-glass-blur:20px;--wf-glass-shadow:0 4px 6px #0000000d;display:block}wizard-form[theme=dark]{--wf-color-surface:#2d2d2d;--wf-color-surface-hover:#3d3d3d;--wf-color-border:#4d4d4d;--wf-color-text:#f8f9fa;--wf-color-text-secondary:#d0d0d0;--wf-color-text-muted:#adb5bd;--wf-color-badge-bg:#3d3d3d;--wf-color-badge-border:#4d4d4d;--wf-color-badge-text:#adb5bd;--wf-color-progress-active:#c8c8c899;--wf-color-progress-inactive:#64646499;--wf-glass-bg:#2d2d2db3;--wf-glass-bg-hover:#3c3c3ccc;--wf-glass-border:#ffffff1a}@media (prefers-color-scheme:dark){wizard-form[theme=auto]{--wf-color-surface:#2d2d2d;--wf-color-surface-hover:#3d3d3d;--wf-color-border:#4d4d4d;--wf-color-text:#f8f9fa;--wf-color-text-secondary:#d0d0d0;--wf-color-text-muted:#adb5bd;--wf-color-badge-bg:#3d3d3d;--wf-color-badge-border:#4d4d4d;--wf-color-badge-text:#adb5bd;--wf-color-progress-active:#c8c8c899;--wf-color-progress-inactive:#64646499;--wf-glass-bg:#2d2d2db3;--wf-glass-bg-hover:#3c3c3ccc;--wf-glass-border:#ffffff1a}}wizard-form .wf-container{margin:0 auto}wizard-form .wf-progress{gap:var(--wf-spacing-4,16px);margin-top:var(--wf-spacing-6,24px);display:flex}wizard-form .wf-progress-segment{background-color:var(--wf-color-progress-inactive,#d9d9d999);border-radius:var(--wf-radius-full,99px);width:32px;height:8px;transition:background-color .3s}wizard-form .wf-progress-segment.completed,wizard-form .wf-progress-segment.active{background-color:var(--wf-color-progress-active,#8b8b8b99)}wizard-form .wf-steps-container{min-height:200px}wizard-form .wf-navigation{justify-content:space-between;gap:var(--wf-spacing-4,16px);margin-top:var(--wf-spacing-6,24px);display:flex}wizard-form .wf-btn{justify-content:center;align-items:center;gap:var(--wf-spacing-2,8px);padding:var(--wf-spacing-3,12px)var(--wf-spacing-4,16px);min-height:48px;font-size:var(--wf-font-size-base,1rem);border-radius:var(--wf-radius-md,8px);cursor:pointer;border:1px solid #0000;outline:none;font-family:inherit;font-weight:600;transition:all .15s;display:inline-flex}wizard-form .wf-btn:focus-visible{box-shadow:0 0 0 3px #8040f04d}wizard-form .wf-btn-back{background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);color:var(--wf-color-text,#0a0a0a)}wizard-form .wf-btn-back:hover:not(:disabled){background:var(--wf-glass-bg-hover,#ffffffd9)}wizard-form .wf-btn-next{background-color:var(--wf-color-primary,#8040f0);border:1px solid var(--wf-color-primary-border,#602cbb);color:#fff;flex:1;margin-left:auto;position:relative}wizard-form .wf-btn-next:hover:not(:disabled){filter:brightness(1.1)}wizard-form .wf-btn:disabled{opacity:.5;cursor:not-allowed}wizard-form .wf-btn-shortcut{right:var(--wf-spacing-4,16px);align-items:center;gap:2px;display:inline-flex;position:absolute}wizard-form .wf-btn-back .wf-btn-shortcut{position:static}wizard-form .wf-success-screen{text-align:center;padding:var(--wf-spacing-6,24px)}wizard-form .wf-loading{border:2px solid #0000001a;border-top-color:#fff;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite wf-spin;display:inline-block}@keyframes wf-spin{to{transform:rotate(360deg)}}wizard-form .wf-form-error{padding:var(--wf-spacing-4,16px);margin-bottom:var(--wf-spacing-4,16px);border:1px solid var(--wf-color-error,#dc3545);border-radius:var(--wf-radius-md,8px);color:var(--wf-color-error,#dc3545);font-size:var(--wf-font-size-base,1rem);background-color:#dc35451a}wf-success{display:block}wf-success h1,wf-success h2,wf-success h3{margin:0 0 var(--wf-spacing-4,16px)0;color:var(--wf-color-text,#212529);font-weight:600}wf-success p{color:var(--wf-color-text-muted,#6c757d);margin:0}wf-step{width:100%;display:none}wf-step[active]{animation:.3s forwards wf-stepFadeIn;display:block}wf-step[direction=forward][active]{animation:.3s forwards wf-stepSlideInRight}wf-step[direction=backward][active]{animation:.3s forwards wf-stepSlideInLeft}wf-step[leaving]{animation:.2s forwards wf-stepFadeOut;display:block}@keyframes wf-stepFadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes wf-stepFadeOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-10px)}}@keyframes wf-stepSlideInRight{0%{opacity:0;transform:translate(30px)}to{opacity:1;transform:translate(0)}}@keyframes wf-stepSlideInLeft{0%{opacity:0;transform:translate(-30px)}to{opacity:1;transform:translate(0)}}wf-step .wf-step-content{gap:var(--wf-spacing-4,16px);flex-direction:column;display:flex}wf-step h1,wf-step h2,wf-step h3{color:var(--wf-color-text,#212529);margin:0;font-weight:600}wf-step h2{font-size:var(--wf-font-size-3xl,2rem)}wf-step p{color:var(--wf-color-text-muted,#6c757d);font-size:var(--wf-font-size-xl,1.375rem);margin:0}wf-options{display:block}wf-options[hidden]{display:none}wf-options .wf-options-container{gap:var(--wf-spacing-4,16px);grid-template-columns:repeat(2,1fr);display:grid}wf-options[columns="1"] .wf-options-container{grid-template-columns:1fr}@media (width<=600px){wf-options .wf-options-container{grid-template-columns:1fr}}wf-options .wf-error-message{margin-top:var(--wf-spacing-2,8px);font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-error,#dc3545);min-height:20px;display:block}wf-options .wf-other-container{margin-top:var(--wf-spacing-4,16px)}wf-options .wf-other-label{margin-bottom:var(--wf-spacing-2,8px);font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text,#0a0a0a);font-weight:500;display:block}wf-options .wf-other-label span{color:var(--wf-color-text-muted,#646464);font-weight:400}wf-options .wf-other-input-wrapper{align-items:center;gap:var(--wf-spacing-3,12px);min-height:var(--wf-input-min-height,56px);background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);border-radius:var(--wf-radius-md,8px);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);padding-left:var(--wf-spacing-4,16px);transition:border-color .15s,box-shadow .15s,background .15s;display:flex}wf-options .wf-other-input-wrapper:focus-within{border-color:var(--wf-color-primary,#8040f0);box-shadow:0 0 0 3px #8040f01a}wf-options .wf-other-input{min-height:calc(var(--wf-input-min-height,56px) - 2px);padding:var(--wf-spacing-4,16px);font-size:var(--wf-font-size-base,1rem);color:var(--wf-color-text,#0a0a0a);box-sizing:border-box;background:0 0;border:none;outline:none;flex:1;padding-left:0;font-weight:500}wf-options .wf-other-input::placeholder{color:var(--wf-color-text-muted,#646464);font-weight:500}wf-option{display:block}wf-option[hidden]{display:none}wf-option .wf-option-card{align-items:center;gap:var(--wf-spacing-3,12px);width:100%;min-height:var(--wf-input-min-height,56px);padding:var(--wf-spacing-3,12px);background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);border-radius:var(--wf-radius-md,8px);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);cursor:pointer;text-align:left;font-family:inherit;font-size:var(--wf-font-size-base,1rem);color:var(--wf-color-text,#0a0a0a);box-sizing:border-box;outline:none;font-weight:500;transition:border-color .15s,background .15s,transform .1s;display:flex}wf-option .wf-option-card:hover:not(:disabled){border-color:var(--wf-color-primary,#8040f0);background:var(--wf-glass-bg-hover,#ffffffd9)}wf-option .wf-option-card:focus-visible{border-color:var(--wf-color-primary,#8040f0);box-shadow:0 0 0 3px #8040f033}wf-option .wf-option-card[aria-selected=true]{border-color:var(--wf-color-primary,#8040f0);background-color:var(--wf-color-primary-light,#8040f01a)}wf-option .wf-option-card:disabled{opacity:.5;cursor:not-allowed}wf-option .wf-option-card:active:not(:disabled){transform:scale(.98)}wf-option .wf-option-card.selecting{animation:.3s wf-blink}@keyframes wf-blink{0%,to{opacity:1}50%{opacity:.5}}wf-option .wf-option-content{flex:1;min-width:0}wf-option .wf-option-content strong,wf-option .wf-option-content h3,wf-option .wf-option-content h4{margin:0;font-weight:600;display:block}wf-option .wf-option-content span,wf-option .wf-option-content p{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text-muted,#646464);margin:4px 0 0;display:block}wf-progress{display:block}wf-progress[hidden]{display:none}wf-progress .wf-progress{gap:var(--wf-spacing-4,16px);display:flex}wf-progress .wf-progress-segment{background-color:var(--wf-color-progress-inactive,#d9d9d999);border-radius:var(--wf-radius-full,99px);width:32px;height:8px;transition:background-color .3s}wf-progress .wf-progress-segment.completed,wf-progress .wf-progress-segment.active{background-color:var(--wf-color-progress-active,#8b8b8b99)}wf-badge{display:inline-flex}wf-badge[hidden]{display:none}wf-badge .wf-badge{box-sizing:border-box;min-width:24px;height:24px;padding:var(--wf-spacing-1,4px)var(--wf-spacing-2,8px);font-size:var(--wf-font-size-xs,.75rem);text-transform:uppercase;flex-shrink:0;justify-content:center;align-items:center;font-family:inherit;font-weight:500;line-height:1;display:inline-flex}wf-badge .wf-badge--default{background-color:var(--wf-color-badge-bg,#fcfcfc);border:1px solid var(--wf-color-badge-border,#d4d4d4);border-radius:var(--wf-radius-sm,4px);color:var(--wf-color-badge-text,#5f5f5f)}wf-badge .wf-badge--selected{background-color:var(--wf-color-primary,#8040f0);border:1px solid var(--wf-color-primary,#8040f0);border-radius:var(--wf-radius-sm,4px);color:#fff}wf-badge .wf-badge--button{border-radius:var(--wf-radius-sm,4px);color:#ffffffa6;background-color:#0000;border:none}wf-badge .wf-badge--button-secondary{border-radius:var(--wf-radius-sm,4px);color:var(--wf-color-text-muted,#5f5f5f);background-color:#0000;border:none}wf-layout{box-sizing:border-box;display:block}wf-layout[hidden]{display:none}wf-layout.wf-layout--width-full{width:100%}wf-layout.wf-layout--width-auto{width:auto}wf-layout.wf-layout--width-fit{width:fit-content}wf-thank-you{text-align:center;padding:var(--wf-spacing-8,48px)var(--wf-spacing-4,24px);display:block}wf-thank-you[hidden]{display:none}wf-thank-you .wf-thank-you-icon{width:72px;height:72px;margin:0 auto var(--wf-spacing-4,24px);background:linear-gradient(135deg,#10b981 0%,#059669 100%);border-radius:50%;justify-content:center;align-items:center;display:flex;box-shadow:0 10px 25px -5px #10b98166}wf-thank-you .wf-thank-you-icon svg{color:#fff;width:36px;height:36px}wf-thank-you .wf-thank-you-title{color:var(--wf-color-text,#1e293b);margin:0 0 12px;font-size:28px;font-weight:700}wf-thank-you .wf-thank-you-subtitle{color:var(--wf-color-text-muted,#64748b);margin:0 0 24px;font-size:16px;line-height:1.6}wf-thank-you [slot=footer]{margin-top:var(--wf-spacing-4,24px)}wf-input,wf-email,wf-textarea,wf-field,wf-number{display:block}wf-input[hidden],wf-email[hidden],wf-textarea[hidden],wf-field[hidden],wf-number[hidden]{display:none}.wf-field-container{gap:var(--wf-spacing-2,8px);flex-direction:column;display:flex}.wf-label{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text,#0a0a0a);font-weight:500}.wf-label-required:after{content:" *";color:var(--wf-color-error,#dc3545)}.wf-error-message{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-error,#dc3545)}.wf-hint{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text-muted,#646464)}.wf-input{width:100%;min-height:var(--wf-input-min-height,56px);padding:var(--wf-spacing-4,16px);font-size:var(--wf-font-size-base,1rem);background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);border-radius:var(--wf-radius-md,8px);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);color:var(--wf-color-text,#0a0a0a);box-sizing:border-box;outline:none;font-family:inherit;font-weight:400;transition:border-color .15s,box-shadow .15s,background .15s}.wf-input::placeholder{color:var(--wf-color-text-muted,#646464);font-weight:500}.wf-input:focus{border-color:var(--wf-color-primary,#8040f0);box-shadow:0 0 0 3px #8040f033}.wf-input:disabled{opacity:.5;cursor:not-allowed}.wf-input.wf-input-error{border-color:var(--wf-color-error,#dc3545)}.wf-input.wf-input-error:focus{box-shadow:0 0 0 3px #dc354533}.wf-textarea{width:100%;padding:var(--wf-spacing-4,16px);font-size:var(--wf-font-size-base,1rem);background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);border-radius:var(--wf-radius-lg,12px);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);color:var(--wf-color-text,#212529);box-sizing:border-box;resize:vertical;outline:none;min-height:100px;font-family:inherit;transition:border-color .15s,box-shadow .15s,background .15s}.wf-textarea::placeholder{color:var(--wf-color-text-muted,#6c757d)}.wf-textarea:focus{border-color:var(--wf-color-primary,#8b5cf6);box-shadow:0 0 0 3px #8b5cf633}.wf-textarea:disabled{opacity:.5;cursor:not-allowed}.wf-textarea.wf-textarea-error{border-color:var(--wf-color-error,#dc3545)}.wf-textarea.wf-textarea-error:focus{box-shadow:0 0 0 3px #dc354533}.wf-char-count{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text-muted,#6c757d);text-align:right}.wf-char-count.wf-char-limit{color:var(--wf-color-error,#dc3545)}wf-field .wf-input-wrapper{position:relative}wf-field .wf-input-wrapper input,wf-field .wf-input-wrapper textarea,wf-field .wf-input-wrapper select{width:100%;padding:var(--wf-spacing-4,16px);font-size:var(--wf-font-size-base,1rem);background-color:var(--wf-color-surface,#f8f9fa);border:2px solid var(--wf-color-border,#dee2e6);border-radius:var(--wf-radius-lg,12px);color:var(--wf-color-text,#212529);box-sizing:border-box;outline:none;font-family:inherit;transition:border-color .15s,box-shadow .15s}wf-field .wf-input-wrapper input::placeholder,wf-field .wf-input-wrapper textarea::placeholder{color:var(--wf-color-text-muted,#6c757d)}wf-field .wf-input-wrapper input:focus,wf-field .wf-input-wrapper textarea:focus,wf-field .wf-input-wrapper select:focus{border-color:var(--wf-color-primary,#8b5cf6);box-shadow:0 0 0 3px #8b5cf633}wf-field .wf-input-wrapper input:disabled,wf-field .wf-input-wrapper textarea:disabled,wf-field .wf-input-wrapper select:disabled{opacity:.5;cursor:not-allowed}wf-number .wf-input::-webkit-outer-spin-button,wf-number .wf-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}wf-number .wf-input[type=number]{-moz-appearance:textfield}',document.head.appendChild(e)}(),t.DEFAULT_BLOCKED_DOMAINS=Vt,t.FormStateController=mt,t.KeyboardController=gt,t.ValidationController=Bt,t.createHubSpotAdapter=i,t.createRevenueHeroAdapter=o,t.createWebhookAdapter=s,t.default=oe,t.getHubSpotCookie=e,t.init=re,t.isRevenueHeroLoaded=r,Object.defineProperties(t,{Ge:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
269
|
+
`}},ce([mt({type:String})],t.WfThankYou.prototype,"title",2),ce([mt({type:String})],t.WfThankYou.prototype,"subtitle",2),ce([mt({type:Boolean,attribute:"hide-icon"})],t.WfThankYou.prototype,"hideIcon",2),t.WfThankYou=ce([pt("wf-thank-you")],t.WfThankYou),function(){if("undefined"==typeof document)return;const t="wf-global-styles";if(document.getElementById(t))return;const e=document.createElement("style");e.id=t,e.textContent='wizard-form{--wf-color-primary:#8040f0;--wf-color-primary-border:#602cbb;--wf-color-primary-light:#8040f014;--wf-color-surface:#f3f3f5;--wf-color-surface-hover:#e9e9eb;--wf-color-border:#d4d4d4;--wf-color-text:#0a0a0a;--wf-color-text-secondary:#404040;--wf-color-text-muted:#646464;--wf-color-error:#dc3545;--wf-color-badge-bg:#fcfcfc;--wf-color-badge-border:#d4d4d4;--wf-color-badge-text:#5f5f5f;--wf-color-progress-active:#8b8b8b99;--wf-color-progress-inactive:#d9d9d999;--wf-spacing-1:4px;--wf-spacing-2:8px;--wf-spacing-3:12px;--wf-spacing-4:16px;--wf-spacing-5:20px;--wf-spacing-6:24px;--wf-spacing-8:32px;--wf-radius-sm:4px;--wf-radius-md:8px;--wf-radius-lg:8px;--wf-radius-full:99px;--wf-font-size-xs:.75rem;--wf-font-size-sm:.875rem;--wf-font-size-base:1rem;--wf-font-size-lg:1.25rem;--wf-font-size-xl:1.5rem;--wf-font-size-2xl:2rem;--wf-font-size-3xl:2.5rem;--wf-input-min-height:56px;--wf-glass-bg:#ffffffb3;--wf-glass-bg-hover:#ffffffd9;--wf-glass-border:#0000001a;--wf-glass-blur:20px;--wf-glass-shadow:0 4px 6px #0000000d;display:block}wizard-form[theme=dark]{--wf-color-surface:#2d2d2d;--wf-color-surface-hover:#3d3d3d;--wf-color-border:#4d4d4d;--wf-color-text:#f8f9fa;--wf-color-text-secondary:#d0d0d0;--wf-color-text-muted:#adb5bd;--wf-color-badge-bg:#3d3d3d;--wf-color-badge-border:#4d4d4d;--wf-color-badge-text:#adb5bd;--wf-color-progress-active:#c8c8c899;--wf-color-progress-inactive:#64646499;--wf-glass-bg:#2d2d2db3;--wf-glass-bg-hover:#3c3c3ccc;--wf-glass-border:#ffffff1a}@media (prefers-color-scheme:dark){wizard-form[theme=auto]{--wf-color-surface:#2d2d2d;--wf-color-surface-hover:#3d3d3d;--wf-color-border:#4d4d4d;--wf-color-text:#f8f9fa;--wf-color-text-secondary:#d0d0d0;--wf-color-text-muted:#adb5bd;--wf-color-badge-bg:#3d3d3d;--wf-color-badge-border:#4d4d4d;--wf-color-badge-text:#adb5bd;--wf-color-progress-active:#c8c8c899;--wf-color-progress-inactive:#64646499;--wf-glass-bg:#2d2d2db3;--wf-glass-bg-hover:#3c3c3ccc;--wf-glass-border:#ffffff1a}}wizard-form .wf-container{margin:0 auto}wizard-form .wf-progress{gap:var(--wf-spacing-4,16px);margin-top:var(--wf-spacing-6,24px);display:flex}wizard-form .wf-progress-segment{background-color:var(--wf-color-progress-inactive,#d9d9d999);border-radius:var(--wf-radius-full,99px);width:32px;height:8px;transition:background-color .3s}wizard-form .wf-progress-segment.completed,wizard-form .wf-progress-segment.active{background-color:var(--wf-color-progress-active,#8b8b8b99)}wizard-form .wf-steps-container{min-height:200px}wizard-form .wf-navigation{justify-content:space-between;gap:var(--wf-spacing-4,16px);margin-top:var(--wf-spacing-6,24px);display:flex}wizard-form .wf-btn{justify-content:center;align-items:center;gap:var(--wf-spacing-2,8px);padding:var(--wf-spacing-3,12px)var(--wf-spacing-4,16px);min-height:48px;font-size:var(--wf-font-size-base,1rem);border-radius:var(--wf-radius-md,8px);cursor:pointer;border:1px solid #0000;outline:none;font-family:inherit;font-weight:600;transition:all .15s;display:inline-flex}wizard-form .wf-btn:focus-visible{box-shadow:0 0 0 3px #8040f04d}wizard-form .wf-btn-back{background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);color:var(--wf-color-text,#0a0a0a)}wizard-form .wf-btn-back:hover:not(:disabled){background:var(--wf-glass-bg-hover,#ffffffd9)}wizard-form .wf-btn-next{background-color:var(--wf-color-primary,#8040f0);border:1px solid var(--wf-color-primary-border,#602cbb);color:#fff;flex:1;margin-left:auto;position:relative}wizard-form .wf-btn-next:hover:not(:disabled){filter:brightness(1.1)}wizard-form .wf-btn:disabled{opacity:.5;cursor:not-allowed}wizard-form .wf-btn-shortcut{right:var(--wf-spacing-4,16px);align-items:center;gap:2px;display:inline-flex;position:absolute}wizard-form .wf-btn-back .wf-btn-shortcut{position:static}wizard-form .wf-success-screen{text-align:center;padding:var(--wf-spacing-6,24px)}wizard-form .wf-loading{border:2px solid #0000001a;border-top-color:#fff;border-radius:50%;width:20px;height:20px;animation:.8s linear infinite wf-spin;display:inline-block}@keyframes wf-spin{to{transform:rotate(360deg)}}wizard-form .wf-form-error{padding:var(--wf-spacing-4,16px);margin-bottom:var(--wf-spacing-4,16px);border:1px solid var(--wf-color-error,#dc3545);border-radius:var(--wf-radius-md,8px);color:var(--wf-color-error,#dc3545);font-size:var(--wf-font-size-base,1rem);background-color:#dc35451a}wf-success{display:block}wf-success h1,wf-success h2,wf-success h3{margin:0 0 var(--wf-spacing-4,16px)0;color:var(--wf-color-text,#212529);font-weight:600}wf-success p{color:var(--wf-color-text-muted,#6c757d);margin:0}wf-step{width:100%;display:none}wf-step[active]{animation:.3s forwards wf-stepFadeIn;display:block}wf-step[direction=forward][active]{animation:.3s forwards wf-stepSlideInRight}wf-step[direction=backward][active]{animation:.3s forwards wf-stepSlideInLeft}wf-step[leaving]{animation:.2s forwards wf-stepFadeOut;display:block}@keyframes wf-stepFadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}@keyframes wf-stepFadeOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-10px)}}@keyframes wf-stepSlideInRight{0%{opacity:0;transform:translate(30px)}to{opacity:1;transform:translate(0)}}@keyframes wf-stepSlideInLeft{0%{opacity:0;transform:translate(-30px)}to{opacity:1;transform:translate(0)}}wf-step .wf-step-content{gap:var(--wf-spacing-4,16px);flex-direction:column;display:flex}wf-step h1,wf-step h2,wf-step h3{color:var(--wf-color-text,#212529);margin:0;font-weight:600}wf-step h2{font-size:var(--wf-font-size-3xl,2rem)}wf-step p{color:var(--wf-color-text-muted,#6c757d);font-size:var(--wf-font-size-xl,1.375rem);margin:0}wf-options{display:block}wf-options[hidden]{display:none}wf-options .wf-options-container{gap:var(--wf-spacing-4,16px);grid-template-columns:repeat(2,1fr);display:grid}wf-options[columns="1"] .wf-options-container{grid-template-columns:1fr}@media (width<=600px){wf-options .wf-options-container{grid-template-columns:1fr}}wf-options .wf-error-message{margin-top:var(--wf-spacing-2,8px);font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-error,#dc3545);min-height:20px;display:block}wf-options .wf-other-container{margin-top:var(--wf-spacing-4,16px)}wf-options .wf-other-label{margin-bottom:var(--wf-spacing-2,8px);font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text,#0a0a0a);font-weight:500;display:block}wf-options .wf-other-label span{color:var(--wf-color-text-muted,#646464);font-weight:400}wf-options .wf-other-input-wrapper{align-items:center;gap:var(--wf-spacing-3,12px);min-height:var(--wf-input-min-height,56px);background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);border-radius:var(--wf-radius-md,8px);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);padding-left:var(--wf-spacing-4,16px);transition:border-color .15s,box-shadow .15s,background .15s;display:flex}wf-options .wf-other-input-wrapper:focus-within{border-color:var(--wf-color-primary,#8040f0);box-shadow:0 0 0 3px #8040f01a}wf-options .wf-other-input{min-height:calc(var(--wf-input-min-height,56px) - 2px);padding:var(--wf-spacing-4,16px);font-size:var(--wf-font-size-base,1rem);color:var(--wf-color-text,#0a0a0a);box-sizing:border-box;background:0 0;border:none;outline:none;flex:1;padding-left:0;font-weight:500}wf-options .wf-other-input::placeholder{color:var(--wf-color-text-muted,#646464);font-weight:500}wf-option{display:block}wf-option[hidden]{display:none}wf-option .wf-option-card{align-items:center;gap:var(--wf-spacing-3,12px);width:100%;min-height:var(--wf-input-min-height,56px);padding:var(--wf-spacing-3,12px);background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);border-radius:var(--wf-radius-md,8px);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);cursor:pointer;text-align:left;font-family:inherit;font-size:var(--wf-font-size-base,1rem);color:var(--wf-color-text,#0a0a0a);box-sizing:border-box;outline:none;font-weight:500;transition:border-color .15s,background .15s,transform .1s;display:flex}wf-option .wf-option-card:hover:not(:disabled){border-color:var(--wf-color-primary,#8040f0);background:var(--wf-glass-bg-hover,#ffffffd9)}wf-option .wf-option-card:focus-visible{border-color:var(--wf-color-primary,#8040f0);box-shadow:0 0 0 3px #8040f033}wf-option .wf-option-card[aria-selected=true]{border-color:var(--wf-color-primary,#8040f0);background-color:var(--wf-color-primary-light,#8040f01a)}wf-option .wf-option-card:disabled{opacity:.5;cursor:not-allowed}wf-option .wf-option-card:active:not(:disabled){transform:scale(.98)}wf-option .wf-option-card.selecting{animation:.3s wf-blink}@keyframes wf-blink{0%,to{opacity:1}50%{opacity:.5}}wf-option .wf-option-content{flex:1;min-width:0}wf-option .wf-option-content strong,wf-option .wf-option-content h3,wf-option .wf-option-content h4{margin:0;font-weight:600;display:block}wf-option .wf-option-content span,wf-option .wf-option-content p{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text-muted,#646464);margin:4px 0 0;display:block}wf-progress{display:block}wf-progress[hidden]{display:none}wf-progress .wf-progress{gap:var(--wf-spacing-4,16px);display:flex}wf-progress .wf-progress-segment{background-color:var(--wf-color-progress-inactive,#d9d9d999);border-radius:var(--wf-radius-full,99px);width:32px;height:8px;transition:background-color .3s}wf-progress .wf-progress-segment.completed,wf-progress .wf-progress-segment.active{background-color:var(--wf-color-progress-active,#8b8b8b99)}wf-badge{display:inline-flex}wf-badge[hidden]{display:none}wf-badge .wf-badge{box-sizing:border-box;min-width:24px;height:24px;padding:var(--wf-spacing-1,4px)var(--wf-spacing-2,8px);font-size:var(--wf-font-size-xs,.75rem);text-transform:uppercase;flex-shrink:0;justify-content:center;align-items:center;font-family:inherit;font-weight:500;line-height:1;display:inline-flex}wf-badge .wf-badge--default{background-color:var(--wf-color-badge-bg,#fcfcfc);border:1px solid var(--wf-color-badge-border,#d4d4d4);border-radius:var(--wf-radius-sm,4px);color:var(--wf-color-badge-text,#5f5f5f)}wf-badge .wf-badge--selected{background-color:var(--wf-color-primary,#8040f0);border:1px solid var(--wf-color-primary,#8040f0);border-radius:var(--wf-radius-sm,4px);color:#fff}wf-badge .wf-badge--button{border-radius:var(--wf-radius-sm,4px);color:#ffffffa6;background-color:#0000;border:none}wf-badge .wf-badge--button-secondary{border-radius:var(--wf-radius-sm,4px);color:var(--wf-color-text-muted,#5f5f5f);background-color:#0000;border:none}wf-layout{box-sizing:border-box;display:block}wf-layout[hidden]{display:none}wf-layout.wf-layout--width-full{width:100%}wf-layout.wf-layout--width-auto{width:auto}wf-layout.wf-layout--width-fit{width:fit-content}wf-thank-you{text-align:center;padding:var(--wf-spacing-8,48px)var(--wf-spacing-4,24px);display:block}wf-thank-you[hidden]{display:none}wf-thank-you .wf-thank-you-icon{width:72px;height:72px;margin:0 auto var(--wf-spacing-4,24px);background:linear-gradient(135deg,#10b981 0%,#059669 100%);border-radius:50%;justify-content:center;align-items:center;display:flex;box-shadow:0 10px 25px -5px #10b98166}wf-thank-you .wf-thank-you-icon svg{color:#fff;width:36px;height:36px}wf-thank-you .wf-thank-you-title{color:var(--wf-color-text,#1e293b);margin:0 0 12px;font-size:28px;font-weight:700}wf-thank-you .wf-thank-you-subtitle{color:var(--wf-color-text-muted,#64748b);margin:0 0 24px;font-size:16px;line-height:1.6}wf-thank-you [slot=footer]{margin-top:var(--wf-spacing-4,24px)}wf-input,wf-email,wf-textarea,wf-field,wf-number{display:block}wf-input[hidden],wf-email[hidden],wf-textarea[hidden],wf-field[hidden],wf-number[hidden]{display:none}.wf-field-container{gap:var(--wf-spacing-2,8px);flex-direction:column;display:flex}.wf-label{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text,#0a0a0a);font-weight:500}.wf-label-required:after{content:" *";color:var(--wf-color-error,#dc3545)}.wf-error-message{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-error,#dc3545)}.wf-hint{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text-muted,#646464)}.wf-input{width:100%;min-height:var(--wf-input-min-height,56px);padding:var(--wf-spacing-4,16px);font-size:var(--wf-font-size-base,1rem);background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);border-radius:var(--wf-radius-md,8px);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);color:var(--wf-color-text,#0a0a0a);box-sizing:border-box;outline:none;font-family:inherit;font-weight:400;transition:border-color .15s,box-shadow .15s,background .15s}.wf-input::placeholder{color:var(--wf-color-text-muted,#646464);font-weight:500}.wf-input:focus{border-color:var(--wf-color-primary,#8040f0);box-shadow:0 0 0 3px #8040f033}.wf-input:disabled{opacity:.5;cursor:not-allowed}.wf-input.wf-input-error{border-color:var(--wf-color-error,#dc3545)}.wf-input.wf-input-error:focus{box-shadow:0 0 0 3px #dc354533}.wf-textarea{width:100%;padding:var(--wf-spacing-4,16px);font-size:var(--wf-font-size-base,1rem);background:var(--wf-glass-bg,#ffffffb3);-webkit-backdrop-filter:blur(var(--wf-glass-blur,20px));border:1px solid var(--wf-glass-border,#0000001a);border-radius:var(--wf-radius-lg,12px);box-shadow:var(--wf-glass-shadow,0 4px 6px #0000000d);color:var(--wf-color-text,#212529);box-sizing:border-box;resize:vertical;outline:none;min-height:100px;font-family:inherit;transition:border-color .15s,box-shadow .15s,background .15s}.wf-textarea::placeholder{color:var(--wf-color-text-muted,#6c757d)}.wf-textarea:focus{border-color:var(--wf-color-primary,#8b5cf6);box-shadow:0 0 0 3px #8b5cf633}.wf-textarea:disabled{opacity:.5;cursor:not-allowed}.wf-textarea.wf-textarea-error{border-color:var(--wf-color-error,#dc3545)}.wf-textarea.wf-textarea-error:focus{box-shadow:0 0 0 3px #dc354533}.wf-char-count{font-size:var(--wf-font-size-sm,.875rem);color:var(--wf-color-text-muted,#6c757d);text-align:right}.wf-char-count.wf-char-limit{color:var(--wf-color-error,#dc3545)}wf-field .wf-input-wrapper{position:relative}wf-field .wf-input-wrapper input,wf-field .wf-input-wrapper textarea,wf-field .wf-input-wrapper select{width:100%;padding:var(--wf-spacing-4,16px);font-size:var(--wf-font-size-base,1rem);background-color:var(--wf-color-surface,#f8f9fa);border:2px solid var(--wf-color-border,#dee2e6);border-radius:var(--wf-radius-lg,12px);color:var(--wf-color-text,#212529);box-sizing:border-box;outline:none;font-family:inherit;transition:border-color .15s,box-shadow .15s}wf-field .wf-input-wrapper input::placeholder,wf-field .wf-input-wrapper textarea::placeholder{color:var(--wf-color-text-muted,#6c757d)}wf-field .wf-input-wrapper input:focus,wf-field .wf-input-wrapper textarea:focus,wf-field .wf-input-wrapper select:focus{border-color:var(--wf-color-primary,#8b5cf6);box-shadow:0 0 0 3px #8b5cf633}wf-field .wf-input-wrapper input:disabled,wf-field .wf-input-wrapper textarea:disabled,wf-field .wf-input-wrapper select:disabled{opacity:.5;cursor:not-allowed}wf-number .wf-input::-webkit-outer-spin-button,wf-number .wf-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}wf-number .wf-input[type=number]{-moz-appearance:textfield}',document.head.appendChild(e)}(),t.DEFAULT_BLOCKED_DOMAINS=jt,t.FormStateController=gt,t.KeyboardController=bt,t.ValidationController=Rt,t.createHubSpotAdapter=r,t.createRevenueHeroAdapter=o,t.createWebhookAdapter=s,t.default=oe,t.getHubSpotCookie=e,t.init=ie,t.isRevenueHeroLoaded=i,Object.defineProperties(t,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
270
270
|
//# sourceMappingURL=wizard-form.min.js.map
|