@calcom/embed-core
Advanced tools
Comparing version 1.1.0-beta.8 to 1.1.0-beta.10
@@ -1,1 +0,1 @@ | ||
var t=Object.defineProperty,e=Object.defineProperties,o=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(e,o,r)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,s=(t,e)=>{for(var o in e||(e={}))n.call(e,o)&&a(t,o,e[o]);if(r)for(var o of r(e))i.call(e,o)&&a(t,o,e[o]);return t},l=(t,r)=>e(t,o(r));class d extends HTMLElement{static updatedClassString(t,e){return[e.replace(/hidden|md:right-10|md:left-10|left-4|right-4/g,""),"bottom-right"===t?"md:right-10 right-4":"md:left-10 left-4"].join(" ")}static get observedAttributes(){return["data-button-text","data-hide-button-icon","data-button-position","data-button-color","data-button-text-color"]}attributeChangedCallback(t,e,o){var r,n,i,a,s;if("data-button-text"===t){const t=null==(r=this.shadowRoot)?void 0:r.querySelector("#button");if(!t)throw new Error("Button not found");t.innerHTML=o}else if("data-hide-button-icon"===t){const t=null==(n=this.shadowRoot)?void 0:n.querySelector("#button-icon");if(!t)throw new Error("Button not found");t.style.display="true"==o?"none":"block"}else if("data-button-position"===t){const t=null==(i=this.shadowRoot)?void 0:i.querySelector("button");if(!t)throw new Error("Button not found");t.className=d.updatedClassString(o,t.className)}else if("data-button-color"===t){const t=null==(a=this.shadowRoot)?void 0:a.querySelector("button");if(!t)throw new Error("Button not found");t.style.backgroundColor=o}else if("data-button-text-color"===t){const t=null==(s=this.shadowRoot)?void 0:s.querySelector("button");if(!t)throw new Error("Button not found");t.style.color=o}}constructor(){super();const t=this.dataset.buttonText,e=this.dataset.buttonPosition,o=this.dataset.buttonColor,r=this.dataset.buttonTextColor,n=`<style>${window.Cal.__css}</style> ${(({buttonText:t,buttonClasses:e,buttonColor:o,buttonTextColor:r})=>`<button class="hidden fixed md:bottom-6 bottom-4 md:right-10 right-4 md:left-10 left-4 ${e.join(" ")} flex h-16 origin-center bg-red-50 transform cursor-pointer items-center\nrounded-full py-4 px-6 text-base outline-none drop-shadow-md transition focus:outline-none fo\ncus:ring-4 focus:ring-gray-600 focus:ring-opacity-50 active:scale-95" \nstyle="background-color:${o}; color:${r} z-index: 10001">\n<div id="button-icon" class="mr-3 flex items-center justify-center">\n <svg\n\tclass="h-7 w-7"\n\tfill="none"\n\tstroke="currentColor"\n\tviewBox="0 0 24 24"\n\txmlns="http://www.w3.org/2000/svg">\n\t<path\n\t strokeLinecap="round"\n\t strokeLinejoin="round"\n\t strokeWidth="2"\n\t d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>\n </svg>\n</div>\n<div id="button" class="font-semibold leading-5 antialiased">${t}</div>\n</button>`)({buttonText:t,buttonClasses:[d.updatedClassString(e,"")],buttonColor:o,buttonTextColor:r})}`;this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=n}}var c="@-webkit-keyframes loader{0%{transform:rotate(0)}25%{transform:rotate(180deg)}50%{transform:rotate(180deg)}75%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@keyframes loader{0%{transform:rotate(0)}25%{transform:rotate(180deg)}50%{transform:rotate(180deg)}75%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@-webkit-keyframes loader-inner{0%{height:0%}25%{height:0%}50%{height:100%}75%{height:100%}to{height:0%}}@keyframes loader-inner{0%{height:0%}25%{height:0%}50%{height:100%}75%{height:100%}to{height:0%}}.loader-inner{vertical-align:top;display:inline-block;width:100%;-webkit-animation:loader-inner 2s infinite ease-in;animation:loader-inner 2s infinite ease-in}.loader{display:block;width:30px;height:30px;position:relative;border-width:4px;border-style:solid;-webkit-animation:loader 2s infinite ease;animation:loader 2s infinite ease}.loader.modal-loader{margin:60px auto}\n";const u=t=>"404"===t?"Error Code: 404. Cal Link seems to be wrong.":`Error Code: ${t}. Something went wrong.`;class h extends HTMLElement{static get observedAttributes(){return["loading"]}attributeChangedCallback(t,e,o){if("loading"===t)if("done"==o)this.shadowRoot.querySelector(".loader").style.display="none";else if("failed"===o){this.shadowRoot.querySelector(".loader").style.display="none",this.shadowRoot.querySelector("#error").style.display="block",this.shadowRoot.querySelector("slot").style.visibility="hidden";const t=u(this.dataset.errorCode);this.shadowRoot.querySelector("#error").innerText=t}}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`<style>${window.Cal.__css}</style><style>${c}</style><div id="wrapper" style="top:calc(50% - 30px); left:calc(50% - 30px)" class="absolute z-highest">\n<div class="loader border-brand dark:border-darkmodebrand">\n\t<span class="loader-inner bg-brand dark:bg-darkmodebrand"></span>\n</div>\n<div id="error" class="hidden">\nSomething went wrong.\n</div>\n</div>\n<slot></slot>`}}class p extends HTMLElement{static get observedAttributes(){return["state"]}show(t){this.shadowRoot.host.style.visibility=t?"visible":"hidden",t||(document.body.style.overflow=p.htmlOverflow)}close(){this.show(!1)}attributeChangedCallback(t,e,o){if("state"===t)if("loaded"==o)this.shadowRoot.querySelector(".loader").style.display="none";else if("started"===o)this.show(!0);else if("closed"==o)this.show(!1);else if("failed"===o){this.shadowRoot.querySelector(".loader").style.display="none",this.shadowRoot.querySelector("#error").style.display="inline-block";const t=u(this.dataset.errorCode);this.shadowRoot.querySelector("#error").innerText=t}}connectedCallback(){const t=this.shadowRoot.querySelector(".close");document.addEventListener("keydown",(t=>{"Escape"===t.key&&this.close()}),{once:!0}),this.shadowRoot.host.addEventListener("click",(t=>{this.close()})),t.onclick=()=>{this.close()}}constructor(){super();const t=`<style>${window.Cal.__css}</style><style>${c}</style><style>\n.my-backdrop {\n position:fixed;\n width:100%;\n height:100%;\n top:0;\n left:0;\n z-index:99999999;\n display:block;\n background-color:rgb(5,5,5, 0.8)\n}\n\n@media only screen and (min-width:600px) {\n .modal-box {\n margin:0 auto;\n margin-top:20px;\n margin-bottom:20px;\n position:absolute;\n width:100%;\n top:50%;\n left:50%;\n transform: translateY(-50%) translateX(-50%);\n overflow: scroll;\n }\n}\n\n@media only screen and (max-width:600px) {\n .modal-box {\n width: 100%;\n height: 80%;\n position:fixed;\n top:50px;\n left:0;\n right: 0;\n margin: 0;\n }\n}\n\n.header {\n position: relative;\n float:right;\n top: 10px;\n}\n.close {\n font-size: 30px;\n left: -20px;\n position: relative;\n color:white;\n cursor: pointer;\n}\n/*Modal background is black only, so hardcode white */\n.loader {\n --cal-brand-color:white;\n}\n</style>\n<div class="my-backdrop">\n<div class="header">\n <span class="close">×</span>\n</div>\n<div class="modal-box">\n <div class="body">\n <div id="wrapper" class="z-[999999999999] absolute flex w-full items-center">\n <div class="loader modal-loader border-brand dark:border-darkmodebrand">\n <span class="loader-inner bg-brand dark:bg-darkmodebrand"></span>\n </div>\n </div>\n <div id="error" class="hidden left-1/2 -translate-x-1/2 relative text-white"></div>\n <slot></slot>\n </div>\n</div>\n</div>`;this.attachShadow({mode:"open"}),p.htmlOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.shadowRoot.innerHTML=t}}function b(t,e){const o=new window.CustomEvent(t,{detail:e});window.dispatchEvent(o)}class f{static parseAction(t){if(!t)return null;const[e,o,r]=t.split(":");return"CAL"!==e?null:{ns:o,type:r}}getFullActionName(t){return this.namespace?`CAL:${this.namespace}:${t}`:`CAL::${t}`}fire(t,e){const o=this.getFullActionName(t),r={type:t,namespace:this.namespace,fullType:o,data:e};b(o,r),b(this.getFullActionName("*"),r)}on(t,e){const o=this.getFullActionName(t);window.addEventListener(o,e)}off(t,e){const o=this.getFullActionName(t);window.removeEventListener(o,e)}constructor(t){t=t||"",this.namespace=t}}const m={}.NEXT_PUBLIC_WEBAPP_URL_TYPO||"https://undefined";customElements.define("cal-modal-box",p),customElements.define("cal-floating-button",d),customElements.define("cal-inline",h);const g=window.Cal;if(!g||!g.q)throw new Error("Cal is not defined. This shouldn't happen");function w(...t){console.log(...t)}function y(t,e){function o(t,e){return"string"==typeof e?typeof t==e:t instanceof e}function r(t){return void 0===t}if(e.required&&r(t))throw new Error("Argument is required");for(const[n,i]of Object.entries(e.props)){if(i.required&&r(t[n]))throw new Error(`"${n}" is required`);let e=!0;if(i.type&&!r(t[n])&&(i.type instanceof Array?i.type.forEach((r=>{e=e||o(t[n],r)})):e=o(t[n],i.type)),!e)throw new Error(`"${n}" is of wrong type.Expected type "${i.type}"`)}}g.fingerprint="00fd041ac",g.__css="*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e1e1e1}:before,:after{--tw-content: \"\"}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol,\"Noto Color Emoji\"}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:Roboto Mono,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#acacac}input:-ms-input-placeholder,textarea:-ms-input-placeholder{opacity:1;color:#acacac}input::placeholder,textarea::placeholder{opacity:1;color:#acacac}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}[type=text],[type=email],[type=url],[type=password],[type=number],[type=date],[type=datetime-local],[type=month],[type=search],[type=tel],[type=time],[type=week],[multiple],textarea,select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#888;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow: 0 0 #0000}[type=text]:focus,[type=email]:focus,[type=url]:focus,[type=password]:focus,[type=number]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=month]:focus,[type=search]:focus,[type=tel]:focus,[type=time]:focus,[type=week]:focus,[multiple]:focus,textarea:focus,select:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}input::-moz-placeholder,textarea::-moz-placeholder{color:#888;opacity:1}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#888;opacity:1}input::placeholder,textarea::placeholder{color:#888;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}select{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23888888' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:initial;background-position:initial;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;-webkit-print-color-adjust:exact;color-adjust:exact;print-color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;flex-shrink:0;height:1rem;width:1rem;color:#2563eb;background-color:#fff;border-color:#888;border-width:1px;--tw-shadow: 0 0 #0000}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 2px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}[type=checkbox]:checked,[type=radio]:checked{border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}[type=checkbox]:checked{background-image:url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\")}[type=radio]:checked{background-image:url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\")}[type=checkbox]:checked:hover,[type=checkbox]:checked:focus,[type=radio]:checked:hover,[type=radio]:checked:focus{border-color:transparent;background-color:currentColor}[type=checkbox]:indeterminate{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e\");border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}[type=checkbox]:indeterminate:hover,[type=checkbox]:indeterminate:focus{border-color:transparent;background-color:currentColor}[type=file]{background:unset;border-color:inherit;border-width:0;border-radius:0;padding:0;font-size:unset;line-height:inherit}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,:before,:after{--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-4{bottom:1rem}.right-4{right:1rem}.left-4{left:1rem}.left-1\\/2{left:50%}.z-\\[999999999999\\]{z-index:999999999999}.mr-3{margin-right:.75rem}.flex{display:flex}.hidden{display:none}.h-16{height:4rem}.h-7{height:1.75rem}.w-7{width:1.75rem}.w-full{width:100%}.origin-center{transform-origin:center}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-full{border-radius:9999px}.border-brand{border-color:var(--cal-brand-color, black)}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity))}.bg-brand{background-color:var(--cal-brand-color, black)}.py-4{padding-top:1rem;padding-bottom:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.text-base{font-size:1rem;line-height:1.5rem}.font-semibold{font-weight:600}.leading-5{line-height:1.25rem}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-md{--tw-drop-shadow: drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@font-face{font-family:Cal Sans;src:url(https://cal.com/cal.ttf)}h1,h2,h3,h4,h5,h6{font-family:Cal Sans;font-weight:400;letter-spacing:normal}html,body,:host{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-gray-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(73 73 73 / var(--tw-ring-opacity))}.focus\\:ring-opacity-50:focus{--tw-ring-opacity: .5}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark .dark\\:border-darkmodebrand{border-color:var(--brand-color-dark-mode)}.dark .dark\\:bg-darkmodebrand{background-color:var(--brand-color-dark-mode)}@media (min-width: 768px){.md\\:bottom-6{bottom:1.5rem}.md\\:right-10{right:2.5rem}.md\\:left-10{left:2.5rem}}\n",document.head.appendChild(document.createElement("style")).innerHTML=".cal-embed{border:0px;min-height:300px;margin:0 auto;width:100%}\n";class k{constructor(t,e){this.iframeDoQueue=[],this.__config={origin:m},this.namespace=t,this.actionManager=new f(t),k.actionsManagers=k.actionsManagers||{},k.actionsManagers[t]=this.actionManager,this.processQueue(e),this.actionManager.on("__dimensionChanged",(t=>{const{data:e}=t.detail,o=this.iframe;if(!o)return;let r="px";e.__unit&&(r=e.__unit),e.iframeHeight&&(o.style.height=e.iframeHeight+r),this.modalBox&&(o.style.maxHeight=window.innerHeight+"px")})),this.actionManager.on("__iframeReady",(t=>{this.iframeReady=!0,this.doInIframe({method:"parentKnowsIframeReady",arg:void 0}),this.iframeDoQueue.forEach((({method:t,arg:e})=>{this.doInIframe({method:t,arg:e})}))})),this.actionManager.on("__routeChanged",(()=>{this.inlineEl&&this.inlineEl.__CalAutoScroll&&this.inlineEl.scrollIntoView()})),this.actionManager.on("linkReady",(t=>{var e,o;null==(e=this.modalBox)||e.setAttribute("state","loaded"),null==(o=this.inlineEl)||o.setAttribute("loading","done")})),this.actionManager.on("linkFailed",(t=>{var e,o,r,n;this.iframe&&(null==(e=this.inlineEl)||e.setAttribute("data-error-code",t.detail.data.code),null==(o=this.modalBox)||o.setAttribute("data-error-code",t.detail.data.code),null==(r=this.inlineEl)||r.setAttribute("loading","failed"),null==(n=this.modalBox)||n.setAttribute("state","failed"))}))}static getQueryObject(t){var e;return l(s({},t=t||{}),{guest:null!=(e=t.guests)?e:void 0})}processInstruction(t){if((t=[].slice.call(t,0))[0]instanceof Array)return void t.forEach((t=>{this.processInstruction(t)}));const[e,...o]=t;this[e]||w(`Instruction ${e} not FOUND`);try{this[e](...o)}catch(r){w("Instruction couldn't be executed",r)}return t}processQueue(t){t.forEach((t=>{this.processInstruction(t)})),t.splice(0),t.push=t=>{this.processInstruction(t)}}createIframe({calLink:t,queryObject:e={}}){const o=this.iframe=document.createElement("iframe");o.className="cal-embed",o.name="cal-embed";const a=this.getConfig(),s=e,{iframeAttrs:l}=s,d=((t,e)=>{var o={};for(var a in t)n.call(t,a)&&e.indexOf(a)<0&&(o[a]=t[a]);if(null!=t&&r)for(var a of r(t))e.indexOf(a)<0&&i.call(t,a)&&(o[a]=t[a]);return o})(s,["iframeAttrs"]);!l||"string"==typeof l||l instanceof Array||o.setAttribute("id",l.id);const c=new URLSearchParams;for(const[r,n]of Object.entries(d))void 0!==n&&(n instanceof Array?n.forEach((t=>c.append(r,t))):c.set(r,n));const u=new URL(`${a.origin}/${t}`);u.searchParams.set("embed",this.namespace),a.debug&&u.searchParams.set("debug",""+a.debug);for(const[r,n]of c)u.searchParams.append(r,n);return o.src=u.toString(),o}init(t,e={}){"string"!=typeof t&&(e=t||{}),(null==e?void 0:e.origin)&&(this.__config.origin=e.origin),this.__config.debug=e.debug}getConfig(){return this.__config}inline({calLink:t,elementOrSelector:e,config:o}){y(arguments[0],{required:!0,props:{calLink:{required:!0,type:"string"},elementOrSelector:{required:!0,type:["string",HTMLElement]},config:{required:!1,type:Object}}}),(o=o||{}).__autoScroll=!!o.__autoScroll,o.embedType="inline";const r=this.createIframe({calLink:t,queryObject:k.getQueryObject(o)});r.style.height="100%",r.style.width="100%";const n=e instanceof HTMLElement?e:document.querySelector(e);if(!n)throw new Error("Element not found");const i=document.createElement("template");i.innerHTML='<cal-inline style="max-height:inherit;height:inherit;min-height:inherit;display:flex;position:relative;flex-wrap:wrap;width:100%"></cal-inline>',this.inlineEl=i.content.children[0],this.inlineEl.__CalAutoScroll=o.__autoScroll,this.inlineEl.appendChild(r),n.appendChild(i.content)}floatingButton({calLink:t,buttonText:e="Book my Cal",hideButtonIcon:o=!1,attributes:r,buttonPosition:n="bottom-right",buttonColor:i="rgb(255, 202, 0)",buttonTextColor:a="rgb(20, 30, 47)"}){let s="",l=null;(null==r?void 0:r.id)&&(s+=` id="${r.id}"`,l=document.getElementById(r.id));let d=l;if(!l){const e=document.createElement("template");e.innerHTML=`<cal-floating-button ${s} data-cal-namespace="${this.namespace}" data-cal-link="${t}"></cal-floating-button>`,d=e.content.children[0],document.body.appendChild(e.content)}e&&d.setAttribute("data-button-text",e),d.setAttribute("data-hide-button-icon",""+o),d.setAttribute("data-button-position",""+n),d.setAttribute("data-button-color",""+i),d.setAttribute("data-button-text-color",""+a)}modal({calLink:t,config:e={},uid:o}){const r=document.querySelector(`cal-modal-box[uid="${o}"]`);if(r)return void r.setAttribute("state","started");e.embedType="modal";const n=this.createIframe({calLink:t,queryObject:k.getQueryObject(e)});n.style.borderRadius="8px",n.style.height="100%",n.style.width="100%";const i=document.createElement("template");i.innerHTML=`<cal-modal-box uid="${o}"></cal-modal-box>`,this.modalBox=i.content.children[0],this.modalBox.appendChild(n),this.actionManager.on("__closeIframe",(()=>{this.modalBox.setAttribute("state","closed")})),document.body.appendChild(i.content)}on({action:t,callback:e}){y(arguments[0],{required:!0,props:{action:{required:!0,type:"string"},callback:{required:!0,type:Function}}}),this.actionManager.on(t,e)}off({action:t,callback:e}){this.actionManager.off(t,e)}preload({calLink:t}){y(arguments[0],{required:!0,props:{calLink:{type:"string",required:!0}}});const e=document.body.appendChild(document.createElement("iframe")),o=this.getConfig(),r=new URL(`${o.origin}/${t}`);r.searchParams.set("prerender","true"),e.src=r.toString(),e.style.width="0",e.style.height="0",e.style.display="none"}ui(t){y(t,{required:!0,props:{theme:{required:!1,type:"string"},styles:{required:!1,type:Object}}}),this.doInIframe({method:"ui",arg:t})}doInIframe({method:t,arg:e}){this.iframeReady?this.iframe.contentWindow.postMessage({originator:"CAL",method:t,arg:e},"*"):this.iframeDoQueue.push({method:t,arg:e})}}g.instance=new k("",g.q);for(const[x,v]of Object.entries(g.ns))v.instance=new k(x,v.q);window.addEventListener("message",(t=>{const e=t.data,o=e.fullType,r=f.parseAction(o);if(!r)return;const n=k.actionsManagers[r.ns];if(g.__logQueue=g.__logQueue||[],g.__logQueue.push(l(s({},r),{data:e.data})),!n)throw new Error("Unhandled Action"+r);n.fire(r.type,e.data)})),document.addEventListener("click",(t=>{const e=t.target;if(!(e instanceof HTMLElement))return;const o=e.dataset.calLink;if(!o)return;const r=e.uniqueId=e.uniqueId||Date.now(),n=e.dataset.calNamespace,i=e.dataset.calConfig||"";let a;try{a=JSON.parse(i)}catch(l){a={}}let s=g;if(n&&(s=g.ns[n]),!s)throw new Error(`Namespace ${n} isn't defined`);s("modal",{calLink:o,config:a,uid:r})})); | ||
var t=Object.defineProperty,e=Object.defineProperties,o=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable,a=(e,o,r)=>o in e?t(e,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[o]=r,s=(t,e)=>{for(var o in e||(e={}))n.call(e,o)&&a(t,o,e[o]);if(r)for(var o of r(e))i.call(e,o)&&a(t,o,e[o]);return t},l=(t,r)=>e(t,o(r));class d extends HTMLElement{static updatedClassString(t,e){return[e.replace(/hidden|md:right-10|md:left-10|left-4|right-4/g,""),"bottom-right"===t?"md:right-10 right-4":"md:left-10 left-4"].join(" ")}static get observedAttributes(){return["data-button-text","data-hide-button-icon","data-button-position","data-button-color","data-button-text-color"]}attributeChangedCallback(t,e,o){var r,n,i,a,s;if("data-button-text"===t){const t=null==(r=this.shadowRoot)?void 0:r.querySelector("#button");if(!t)throw new Error("Button not found");t.innerHTML=o}else if("data-hide-button-icon"===t){const t=null==(n=this.shadowRoot)?void 0:n.querySelector("#button-icon");if(!t)throw new Error("Button not found");t.style.display="true"==o?"none":"block"}else if("data-button-position"===t){const t=null==(i=this.shadowRoot)?void 0:i.querySelector("button");if(!t)throw new Error("Button not found");t.className=d.updatedClassString(o,t.className)}else if("data-button-color"===t){const t=null==(a=this.shadowRoot)?void 0:a.querySelector("button");if(!t)throw new Error("Button not found");t.style.backgroundColor=o}else if("data-button-text-color"===t){const t=null==(s=this.shadowRoot)?void 0:s.querySelector("button");if(!t)throw new Error("Button not found");t.style.color=o}}constructor(){super();const t=this.dataset.buttonText,e=this.dataset.buttonPosition,o=this.dataset.buttonColor,r=this.dataset.buttonTextColor,n=`<style>${window.Cal.__css}</style> ${(({buttonText:t,buttonClasses:e,buttonColor:o,buttonTextColor:r})=>`<button class="hidden fixed md:bottom-6 bottom-4 md:right-10 right-4 md:left-10 left-4 ${e.join(" ")} flex h-16 origin-center bg-red-50 transform cursor-pointer items-center\nrounded-full py-4 px-6 text-base outline-none drop-shadow-md transition focus:outline-none fo\ncus:ring-4 focus:ring-gray-600 focus:ring-opacity-50 active:scale-95" \nstyle="background-color:${o}; color:${r} z-index: 10001">\n<div id="button-icon" class="mr-3 flex items-center justify-center">\n <svg\n\tclass="h-7 w-7"\n\tfill="none"\n\tstroke="currentColor"\n\tviewBox="0 0 24 24"\n\txmlns="http://www.w3.org/2000/svg">\n\t<path\n\t strokeLinecap="round"\n\t strokeLinejoin="round"\n\t strokeWidth="2"\n\t d="M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"></path>\n </svg>\n</div>\n<div id="button" class="font-semibold leading-5 antialiased">${t}</div>\n</button>`)({buttonText:t,buttonClasses:[d.updatedClassString(e,"")],buttonColor:o,buttonTextColor:r})}`;this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=n}}var c="@-webkit-keyframes loader{0%{transform:rotate(0)}25%{transform:rotate(180deg)}50%{transform:rotate(180deg)}75%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@keyframes loader{0%{transform:rotate(0)}25%{transform:rotate(180deg)}50%{transform:rotate(180deg)}75%{transform:rotate(360deg)}to{transform:rotate(360deg)}}@-webkit-keyframes loader-inner{0%{height:0%}25%{height:0%}50%{height:100%}75%{height:100%}to{height:0%}}@keyframes loader-inner{0%{height:0%}25%{height:0%}50%{height:100%}75%{height:100%}to{height:0%}}.loader-inner{vertical-align:top;display:inline-block;width:100%;-webkit-animation:loader-inner 2s infinite ease-in;animation:loader-inner 2s infinite ease-in}.loader{display:block;width:30px;height:30px;position:relative;border-width:4px;border-style:solid;-webkit-animation:loader 2s infinite ease;animation:loader 2s infinite ease}.loader.modal-loader{margin:60px auto}\n";const h=t=>"404"===t?"Error Code: 404. Cal Link seems to be wrong.":`Error Code: ${t}. Something went wrong.`;class u extends HTMLElement{static get observedAttributes(){return["loading"]}attributeChangedCallback(t,e,o){if("loading"===t)if("done"==o)this.shadowRoot.querySelector(".loader").style.display="none";else if("failed"===o){this.shadowRoot.querySelector(".loader").style.display="none",this.shadowRoot.querySelector("#error").style.display="block",this.shadowRoot.querySelector("slot").style.visibility="hidden";const t=h(this.dataset.errorCode);this.shadowRoot.querySelector("#error").innerText=t}}constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`<style>${window.Cal.__css}</style><style>${c}</style><div id="wrapper" style="top:calc(50% - 30px); left:calc(50% - 30px)" class="absolute z-highest">\n<div class="loader border-brand dark:border-darkmodebrand">\n\t<span class="loader-inner bg-brand dark:bg-darkmodebrand"></span>\n</div>\n<div id="error" class="hidden">\nSomething went wrong.\n</div>\n</div>\n<slot></slot>`}}class p extends HTMLElement{static get observedAttributes(){return["state"]}show(t){this.shadowRoot.host.style.visibility=t?"visible":"hidden",t||(document.body.style.overflow=p.htmlOverflow)}close(){this.show(!1)}attributeChangedCallback(t,e,o){if("state"===t)if("loaded"==o)this.shadowRoot.querySelector(".loader").style.display="none";else if("started"===o)this.show(!0);else if("closed"==o)this.show(!1);else if("failed"===o){this.shadowRoot.querySelector(".loader").style.display="none",this.shadowRoot.querySelector("#error").style.display="inline-block";const t=h(this.dataset.errorCode);this.shadowRoot.querySelector("#error").innerText=t}}connectedCallback(){const t=this.shadowRoot.querySelector(".close");document.addEventListener("keydown",(t=>{"Escape"===t.key&&this.close()}),{once:!0}),this.shadowRoot.host.addEventListener("click",(t=>{this.close()})),t.onclick=()=>{this.close()}}constructor(){super();const t=`<style>${window.Cal.__css}</style><style>${c}</style><style>\n.my-backdrop {\n position:fixed;\n width:100%;\n height:100%;\n top:0;\n left:0;\n z-index:99999999;\n display:block;\n background-color:rgb(5,5,5, 0.8)\n}\n\n@media only screen and (min-width:600px) {\n .modal-box {\n margin:0 auto;\n margin-top:20px;\n margin-bottom:20px;\n position:absolute;\n width:100%;\n top:50%;\n left:50%;\n transform: translateY(-50%) translateX(-50%);\n overflow: scroll;\n }\n}\n\n@media only screen and (max-width:600px) {\n .modal-box {\n width: 100%;\n height: 80%;\n position:fixed;\n top:50px;\n left:0;\n right: 0;\n margin: 0;\n }\n}\n\n.header {\n position: relative;\n float:right;\n top: 10px;\n}\n.close {\n font-size: 30px;\n left: -20px;\n position: relative;\n color:white;\n cursor: pointer;\n}\n/*Modal background is black only, so hardcode white */\n.loader {\n --cal-brand-color:white;\n}\n</style>\n<div class="my-backdrop">\n<div class="header">\n <span class="close">×</span>\n</div>\n<div class="modal-box">\n <div class="body">\n <div id="wrapper" class="z-[999999999999] absolute flex w-full items-center">\n <div class="loader modal-loader border-brand dark:border-darkmodebrand">\n <span class="loader-inner bg-brand dark:bg-darkmodebrand"></span>\n </div>\n </div>\n <div id="error" class="hidden left-1/2 -translate-x-1/2 relative text-white"></div>\n <slot></slot>\n </div>\n</div>\n</div>`;this.attachShadow({mode:"open"}),p.htmlOverflow=document.body.style.overflow,document.body.style.overflow="hidden",this.shadowRoot.innerHTML=t}}function b(t,e){const o=new window.CustomEvent(t,{detail:e});window.dispatchEvent(o)}class m{static parseAction(t){if(!t)return null;const[e,o,r]=t.split(":");return"CAL"!==e?null:{ns:o,type:r}}getFullActionName(t){return this.namespace?`CAL:${this.namespace}:${t}`:`CAL::${t}`}fire(t,e){const o=this.getFullActionName(t),r={type:t,namespace:this.namespace,fullType:o,data:e};b(o,r),b(this.getFullActionName("*"),r)}on(t,e){const o=this.getFullActionName(t);window.addEventListener(o,e)}off(t,e){const o=this.getFullActionName(t);window.removeEventListener(o,e)}constructor(t){t=t||"",this.namespace=t}}customElements.define("cal-modal-box",p),customElements.define("cal-floating-button",d),customElements.define("cal-inline",u);const f=window.Cal;if(!f||!f.q)throw new Error("Cal is not defined. This shouldn't happen");function g(...t){console.log(...t)}function w(t,e){function o(t,e){return"string"==typeof e?typeof t==e:t instanceof e}function r(t){return void 0===t}if(e.required&&r(t))throw new Error("Argument is required");for(const[n,i]of Object.entries(e.props)){if(i.required&&r(t[n]))throw new Error(`"${n}" is required`);let e=!0;if(i.type&&!r(t[n])&&(i.type instanceof Array?i.type.forEach((r=>{e=e||o(t[n],r)})):e=o(t[n],i.type)),!e)throw new Error(`"${n}" is of wrong type.Expected type "${i.type}"`)}}f.fingerprint={}.EMBED_PUBLIC_EMBED_FINGER_PRINT,f.__css="*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e1e1e1}:before,:after{--tw-content: \"\"}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",Segoe UI Symbol,\"Noto Color Emoji\"}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:Roboto Mono,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#acacac}input:-ms-input-placeholder,textarea:-ms-input-placeholder{opacity:1;color:#acacac}input::placeholder,textarea::placeholder{opacity:1;color:#acacac}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}[type=text],[type=email],[type=url],[type=password],[type=number],[type=date],[type=datetime-local],[type=month],[type=search],[type=tel],[type=time],[type=week],[multiple],textarea,select{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:#fff;border-color:#888;border-width:1px;border-radius:0;padding:.5rem .75rem;font-size:1rem;line-height:1.5rem;--tw-shadow: 0 0 #0000}[type=text]:focus,[type=email]:focus,[type=url]:focus,[type=password]:focus,[type=number]:focus,[type=date]:focus,[type=datetime-local]:focus,[type=month]:focus,[type=search]:focus,[type=tel]:focus,[type=time]:focus,[type=week]:focus,[multiple]:focus,textarea:focus,select:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);border-color:#2563eb}input::-moz-placeholder,textarea::-moz-placeholder{color:#888;opacity:1}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#888;opacity:1}input::placeholder,textarea::placeholder{color:#888;opacity:1}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-date-and-time-value{min-height:1.5em}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-top:0;padding-bottom:0}select{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23888888' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e\");background-position:right .5rem center;background-repeat:no-repeat;background-size:1.5em 1.5em;padding-right:2.5rem;-webkit-print-color-adjust:exact;color-adjust:exact;print-color-adjust:exact}[multiple]{background-image:initial;background-position:initial;background-repeat:unset;background-size:initial;padding-right:.75rem;-webkit-print-color-adjust:unset;color-adjust:unset;print-color-adjust:unset}[type=checkbox],[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;-webkit-print-color-adjust:exact;color-adjust:exact;print-color-adjust:exact;display:inline-block;vertical-align:middle;background-origin:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;flex-shrink:0;height:1rem;width:1rem;color:#2563eb;background-color:#fff;border-color:#888;border-width:1px;--tw-shadow: 0 0 #0000}[type=checkbox]{border-radius:0}[type=radio]{border-radius:100%}[type=checkbox]:focus,[type=radio]:focus{outline:2px solid transparent;outline-offset:2px;--tw-ring-inset: var(--tw-empty, );--tw-ring-offset-width: 2px;--tw-ring-offset-color: #fff;--tw-ring-color: #2563eb;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}[type=checkbox]:checked,[type=radio]:checked{border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}[type=checkbox]:checked{background-image:url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e\")}[type=radio]:checked{background-image:url(\"data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e\")}[type=checkbox]:checked:hover,[type=checkbox]:checked:focus,[type=radio]:checked:hover,[type=radio]:checked:focus{border-color:transparent;background-color:currentColor}[type=checkbox]:indeterminate{background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e\");border-color:transparent;background-color:currentColor;background-size:100% 100%;background-position:center;background-repeat:no-repeat}[type=checkbox]:indeterminate:hover,[type=checkbox]:indeterminate:focus{border-color:transparent;background-color:currentColor}[type=file]{background:unset;border-color:inherit;border-width:0;border-radius:0;padding:0;font-size:unset;line-height:inherit}[type=file]:focus{outline:1px solid ButtonText;outline:1px auto -webkit-focus-ring-color}*,:before,:after{--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.bottom-4{bottom:1rem}.right-4{right:1rem}.left-4{left:1rem}.left-1\\/2{left:50%}.z-\\[999999999999\\]{z-index:999999999999}.mr-3{margin-right:.75rem}.flex{display:flex}.hidden{display:none}.h-16{height:4rem}.h-7{height:1.75rem}.w-7{width:1.75rem}.w-full{width:100%}.origin-center{transform-origin:center}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.rounded-full{border-radius:9999px}.border-brand{border-color:var(--cal-brand-color, black)}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity))}.bg-brand{background-color:var(--cal-brand-color, black)}.py-4{padding-top:1rem;padding-bottom:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.text-base{font-size:1rem;line-height:1.5rem}.font-semibold{font-weight:600}.leading-5{line-height:1.25rem}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.outline-none{outline:2px solid transparent;outline-offset:2px}.drop-shadow-md{--tw-drop-shadow: drop-shadow(0 4px 3px rgb(0 0 0 / .07)) drop-shadow(0 2px 2px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-text-decoration-color,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}@font-face{font-family:Cal Sans;src:url(https://cal.com/cal.ttf)}h1,h2,h3,h4,h5,h6{font-family:Cal Sans;font-weight:400;letter-spacing:normal}html,body,:host{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:ring-gray-600:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(73 73 73 / var(--tw-ring-opacity))}.focus\\:ring-opacity-50:focus{--tw-ring-opacity: .5}.active\\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.dark .dark\\:border-darkmodebrand{border-color:var(--brand-color-dark-mode)}.dark .dark\\:bg-darkmodebrand{background-color:var(--brand-color-dark-mode)}@media (min-width: 768px){.md\\:bottom-6{bottom:1.5rem}.md\\:right-10{right:2.5rem}.md\\:left-10{left:2.5rem}}\n",document.head.appendChild(document.createElement("style")).innerHTML=".cal-embed{border:0px;min-height:300px;margin:0 auto;width:100%}\n";class y{constructor(t,e){this.iframeDoQueue=[],this.__config={origin:"https://app.cal.com"},this.namespace=t,this.actionManager=new m(t),y.actionsManagers=y.actionsManagers||{},y.actionsManagers[t]=this.actionManager,this.processQueue(e),this.actionManager.on("__dimensionChanged",(t=>{const{data:e}=t.detail,o=this.iframe;if(!o)return;let r="px";e.__unit&&(r=e.__unit),e.iframeHeight&&(o.style.height=e.iframeHeight+r),this.modalBox&&(o.style.maxHeight=window.innerHeight+"px")})),this.actionManager.on("__iframeReady",(t=>{this.iframeReady=!0,this.doInIframe({method:"parentKnowsIframeReady",arg:void 0}),this.iframeDoQueue.forEach((({method:t,arg:e})=>{this.doInIframe({method:t,arg:e})}))})),this.actionManager.on("__routeChanged",(()=>{this.inlineEl&&this.inlineEl.__CalAutoScroll&&this.inlineEl.scrollIntoView()})),this.actionManager.on("linkReady",(t=>{var e,o;null==(e=this.modalBox)||e.setAttribute("state","loaded"),null==(o=this.inlineEl)||o.setAttribute("loading","done")})),this.actionManager.on("linkFailed",(t=>{var e,o,r,n;this.iframe&&(null==(e=this.inlineEl)||e.setAttribute("data-error-code",t.detail.data.code),null==(o=this.modalBox)||o.setAttribute("data-error-code",t.detail.data.code),null==(r=this.inlineEl)||r.setAttribute("loading","failed"),null==(n=this.modalBox)||n.setAttribute("state","failed"))}))}static getQueryObject(t){var e;return l(s({},t=t||{}),{guest:null!=(e=t.guests)?e:void 0})}processInstruction(t){if((t=[].slice.call(t,0))[0]instanceof Array)return void t.forEach((t=>{this.processInstruction(t)}));const[e,...o]=t;this[e]||g(`Instruction ${e} not FOUND`);try{this[e](...o)}catch(r){g("Instruction couldn't be executed",r)}return t}processQueue(t){t.forEach((t=>{this.processInstruction(t)})),t.splice(0),t.push=t=>{this.processInstruction(t)}}createIframe({calLink:t,queryObject:e={}}){const o=this.iframe=document.createElement("iframe");o.className="cal-embed",o.name="cal-embed";const a=this.getConfig(),s=e,{iframeAttrs:l}=s,d=((t,e)=>{var o={};for(var a in t)n.call(t,a)&&e.indexOf(a)<0&&(o[a]=t[a]);if(null!=t&&r)for(var a of r(t))e.indexOf(a)<0&&i.call(t,a)&&(o[a]=t[a]);return o})(s,["iframeAttrs"]);!l||"string"==typeof l||l instanceof Array||o.setAttribute("id",l.id);const c=new URLSearchParams;for(const[r,n]of Object.entries(d))void 0!==n&&(n instanceof Array?n.forEach((t=>c.append(r,t))):c.set(r,n));const h=new URL(`${a.origin}/${t}`);h.searchParams.set("embed",this.namespace),a.debug&&h.searchParams.set("debug",""+a.debug);for(const[r,n]of c)h.searchParams.append(r,n);return o.src=h.toString(),o}init(t,e={}){"string"!=typeof t&&(e=t||{}),(null==e?void 0:e.origin)&&(this.__config.origin=e.origin),this.__config.debug=e.debug}getConfig(){return this.__config}inline({calLink:t,elementOrSelector:e,config:o}){w(arguments[0],{required:!0,props:{calLink:{required:!0,type:"string"},elementOrSelector:{required:!0,type:["string",HTMLElement]},config:{required:!1,type:Object}}}),(o=o||{}).__autoScroll=!!o.__autoScroll,o.embedType="inline";const r=this.createIframe({calLink:t,queryObject:y.getQueryObject(o)});r.style.height="100%",r.style.width="100%";const n=e instanceof HTMLElement?e:document.querySelector(e);if(!n)throw new Error("Element not found");const i=document.createElement("template");i.innerHTML='<cal-inline style="max-height:inherit;height:inherit;min-height:inherit;display:flex;position:relative;flex-wrap:wrap;width:100%"></cal-inline>',this.inlineEl=i.content.children[0],this.inlineEl.__CalAutoScroll=o.__autoScroll,this.inlineEl.appendChild(r),n.appendChild(i.content)}floatingButton({calLink:t,buttonText:e="Book my Cal",hideButtonIcon:o=!1,attributes:r,buttonPosition:n="bottom-right",buttonColor:i="rgb(255, 202, 0)",buttonTextColor:a="rgb(20, 30, 47)"}){let s="",l=null;(null==r?void 0:r.id)&&(s+=` id="${r.id}"`,l=document.getElementById(r.id));let d=l;if(!l){const e=document.createElement("template");e.innerHTML=`<cal-floating-button ${s} data-cal-namespace="${this.namespace}" data-cal-link="${t}"></cal-floating-button>`,d=e.content.children[0],document.body.appendChild(e.content)}e&&d.setAttribute("data-button-text",e),d.setAttribute("data-hide-button-icon",""+o),d.setAttribute("data-button-position",""+n),d.setAttribute("data-button-color",""+i),d.setAttribute("data-button-text-color",""+a)}modal({calLink:t,config:e={},uid:o}){const r=document.querySelector(`cal-modal-box[uid="${o}"]`);if(r)return void r.setAttribute("state","started");e.embedType="modal";const n=this.createIframe({calLink:t,queryObject:y.getQueryObject(e)});n.style.borderRadius="8px",n.style.height="100%",n.style.width="100%";const i=document.createElement("template");i.innerHTML=`<cal-modal-box uid="${o}"></cal-modal-box>`,this.modalBox=i.content.children[0],this.modalBox.appendChild(n),this.actionManager.on("__closeIframe",(()=>{this.modalBox.setAttribute("state","closed")})),document.body.appendChild(i.content)}on({action:t,callback:e}){w(arguments[0],{required:!0,props:{action:{required:!0,type:"string"},callback:{required:!0,type:Function}}}),this.actionManager.on(t,e)}off({action:t,callback:e}){this.actionManager.off(t,e)}preload({calLink:t}){w(arguments[0],{required:!0,props:{calLink:{type:"string",required:!0}}});const e=document.body.appendChild(document.createElement("iframe")),o=this.getConfig(),r=new URL(`${o.origin}/${t}`);r.searchParams.set("prerender","true"),e.src=r.toString(),e.style.width="0",e.style.height="0",e.style.display="none"}ui(t){w(t,{required:!0,props:{theme:{required:!1,type:"string"},styles:{required:!1,type:Object}}}),this.doInIframe({method:"ui",arg:t})}doInIframe({method:t,arg:e}){this.iframeReady?this.iframe.contentWindow.postMessage({originator:"CAL",method:t,arg:e},"*"):this.iframeDoQueue.push({method:t,arg:e})}}f.instance=new y("",f.q);for(const[k,x]of Object.entries(f.ns))x.instance=new y(k,x.q);window.addEventListener("message",(t=>{const e=t.data,o=e.fullType,r=m.parseAction(o);if(!r)return;const n=y.actionsManagers[r.ns];if(f.__logQueue=f.__logQueue||[],f.__logQueue.push(l(s({},r),{data:e.data})),!n)throw new Error("Unhandled Action"+r);n.fire(r.type,e.data)})),document.addEventListener("click",(t=>{const e=t.target;if(!(e instanceof HTMLElement))return;const o=e.dataset.calLink;if(!o)return;const r=e.uniqueId=e.uniqueId||Date.now(),n=e.dataset.calNamespace,i=e.dataset.calConfig||"";let a;try{a=JSON.parse(i)}catch(l){a={}}let s=f;if(n&&(s=f.ns[n]),!s)throw new Error(`Namespace ${n} isn't defined`);s("modal",{calLink:o,config:a,uid:r})})); |
@@ -1,1 +0,1 @@ | ||
!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerpolicy&&(t.referrerPolicy=e.referrerpolicy),"use-credentials"===e.crossorigin?t.credentials="include":"anonymous"===e.crossorigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();window.fingerprint="00fd041ac",function(e,t,n){const i=function(e,t){e.q.push(t)},o=e.document;e.Cal=e.Cal||function(){const r=e.Cal,c=arguments;if(r.loaded||(r.ns={},r.q=r.q||[],o.head.appendChild(o.createElement("script")).src=t,r.loaded=!0),c[0]===n){const e=function(){i(e,arguments)},t=c[1];return e.q=e.q||[],void("string"==typeof t?(r.ns[t]=e)&&i(e,c):i(r,c))}i(r,c)}}(window,"http://localhost:3000/embed/embed.js","init");const e=window;e.Cal("init",{origin:"http://localhost:3000"});const t=new URL(document.URL).searchParams,n=t.get("embedType"),i=t.get("calLink");if("inline"===n)e.Cal("inline",{elementOrSelector:"#my-embed",calLink:i});else if("floating-popup"===n)e.Cal("floatingButton",{calLink:i,attributes:{id:"my-floating-button"}});else if("element-click"===n){const e=document.createElement("button");e.setAttribute("data-cal-link",i),e.innerHTML="I am a button that exists on your website",document.body.appendChild(e)}e.addEventListener("message",(e=>{const t=e.data;if("cal:preview"!==t.mode)return;const n=window.Cal;if(!n)throw new Error("Cal is not defined yet");if("instruction"==t.type&&n(t.instruction.name,t.instruction.arg),"inlineEmbedDimensionUpdate"==t.type){const e=document.querySelector("#my-embed");e&&(e.style.width=t.data.width,e.style.height=t.data.height)}})); | ||
!function(){const e=document.createElement("link").relList;if(!(e&&e.supports&&e.supports("modulepreload"))){for(const e of document.querySelectorAll('link[rel="modulepreload"]'))t(e);new MutationObserver((e=>{for(const n of e)if("childList"===n.type)for(const e of n.addedNodes)"LINK"===e.tagName&&"modulepreload"===e.rel&&t(e)})).observe(document,{childList:!0,subtree:!0})}function t(e){if(e.ep)return;e.ep=!0;const t=function(e){const t={};return e.integrity&&(t.integrity=e.integrity),e.referrerpolicy&&(t.referrerPolicy=e.referrerpolicy),"use-credentials"===e.crossorigin?t.credentials="include":"anonymous"===e.crossorigin?t.credentials="omit":t.credentials="same-origin",t}(e);fetch(e.href,t)}}();window.fingerprint={}.EMBED_PUBLIC_EMBED_FINGER_PRINT,function(e,t,n){const i=function(e,t){e.q.push(t)},o=e.document;e.Cal=e.Cal||function(){const r=e.Cal,c=arguments;if(r.loaded||(r.ns={},r.q=r.q||[],o.head.appendChild(o.createElement("script")).src=t,r.loaded=!0),c[0]===n){const e=function(){i(e,arguments)},t=c[1];return e.q=e.q||[],void("string"==typeof t?(r.ns[t]=e)&&i(e,c):i(r,c))}i(r,c)}}(window,"undefined","init");const e=window;e.Cal("init",{origin:"https://app.cal.com"});const t=new URL(document.URL).searchParams,n=t.get("embedType"),i=t.get("calLink");if("inline"===n)e.Cal("inline",{elementOrSelector:"#my-embed",calLink:i});else if("floating-popup"===n)e.Cal("floatingButton",{calLink:i,attributes:{id:"my-floating-button"}});else if("element-click"===n){const e=document.createElement("button");e.setAttribute("data-cal-link",i),e.innerHTML="I am a button that exists on your website",document.body.appendChild(e)}e.addEventListener("message",(e=>{const t=e.data;if("cal:preview"!==t.mode)return;const n=window.Cal;if(!n)throw new Error("Cal is not defined yet");if("instruction"==t.type&&n(t.instruction.name,t.instruction.arg),"inlineEmbedDimensionUpdate"==t.type){const e=document.querySelector("#my-embed");e&&(e.style.width=t.data.width,e.style.height=t.data.height)}})); |
{ | ||
"name": "@calcom/embed-core", | ||
"version": "1.1.0-beta.8", | ||
"version": "1.1.0-beta.10", | ||
"description": "This is the vanilla JS core script that embeds Cal Link", | ||
@@ -21,3 +21,3 @@ "main": "./dist/embed/embed.js", | ||
"embed-tests-quick": "QUICK=true yarn embed-tests", | ||
"prepare": "yarn build" | ||
"prepare": "NEXT_PUBLIC_WEBAPP_URL='https://app.cal.com' yarn build" | ||
}, | ||
@@ -24,0 +24,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
131422