@builder.io/sdk
Advanced tools
Comparing version 1.1.27-0 to 1.1.27-1
@@ -0,3 +1,9 @@ | ||
### UPCOMING | ||
- improved logging during JSON.parse errors | ||
- deprecation notice on `Builder.VERSION` | ||
- stop tracking impressions for content with no id | ||
### 1.1.26 | ||
- fix: respect `builder.canTrack` for not setting the session cookie https://github.com/BuilderIO/builder/pull/900 |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("@builder.io/sdk",["exports"],t):t(e.BuilderIO={})}(this,function(exports){"use strict";var __assign=function(){return(__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};!function(){if("undefined"==typeof window||"function"==typeof window.CustomEvent)return!1;window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}}();var isSafari="undefined"!=typeof window&&/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);function nextTick(e){if("function"==typeof setImmediate&&"undefined"==typeof window)return setImmediate(e);if(isSafari||"undefined"==typeof MutationObserver)setTimeout(e);else{var t=0,i=new MutationObserver(function(){return e()}),n=document.createTextNode("");i.observe(n,{characterData:!0}),n.data=String(t=++t)}}var PROPERTY_NAME_DENY_LIST=Object.freeze(["__proto__","prototype","constructor"]),QueryString=function(){function e(){}return e.parseDeep=function(e){var t=this.parse(e);return this.deepen(t)},e.stringifyDeep=function(e){var t=this.flatten(e);return this.stringify(t)},e.parse=function(e){for(var t={},i=("?"===e[0]?e.substr(1):e).split("&"),n=0;n<i.length;n++){var r=i[n].split("=");try{t[decodeURIComponent(r[0])]=decodeURIComponent(r[1]||"")}catch(e){}}return t},e.stringify=function(e){var t="";for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];t&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(n)}return t},e.deepen=function(e){var t={};for(var i in e){for(var n=t,r=i.split("."),o=r.pop(),s=0,a=r;s<a.length;s++){var u=a[s];assertAllowedPropertyName(u),n=n[u]=n[u]||{}}n[o]=e[i]}return t},e.flatten=function(e,t,i){for(var n in void 0===i&&(i={}),e){var r=e[n],o=t?t+"."+n:n;r&&"object"==typeof r?this.flatten(r,o,i):i[o]=r}return i},e}();function assertAllowedPropertyName(e){if(PROPERTY_NAME_DENY_LIST.indexOf(e)>=0)throw new Error('Property name "'+e+'" is not allowed')}var version="1.1.26",Subscription=function(){function e(e,t){this.listeners=e,this.listener=t,this.unsubscribed=!1,this.otherSubscriptions=[]}return Object.defineProperty(e.prototype,"closed",{get:function(){return this.unsubscribed},enumerable:!0,configurable:!0}),e.prototype.add=function(e){this.otherSubscriptions.push(e)},e.prototype.unsubscribe=function(){if(!this.unsubscribed){if(this.listener&&this.listeners){var e=this.listeners.indexOf(this.listener);e>-1&&this.listeners.splice(e,1)}this.otherSubscriptions.forEach(function(e){return e.unsubscribe()}),this.unsubscribed=!0}},e}(),BehaviorSubject=function(){function e(e){this.value=e,this.listeners=[],this.errorListeners=[]}return e.prototype.next=function(e){this.value=e;for(var t=0,i=this.listeners;t<i.length;t++){(0,i[t])(e)}},e.prototype.map=function(t){var i=new e(t(this.value));return this.subscribe(function(e){i.next(t(e))}),this.catch(function(e){i.error(e)}),i},e.prototype.catch=function(e){return this.errorListeners.push(e),new Subscription(this.errorListeners,e)},e.prototype.error=function(e){for(var t=0,i=this.errorListeners;t<i.length;t++){(0,i[t])(e)}},e.prototype.subscribe=function(e,t){return this.listeners.push(e),t&&this.errorListeners.push(t),new Subscription(this.listeners,e)},e.prototype.toPromise=function(){var e=this;return new Promise(function(t,i){var n=e.subscribe(function(e){t(e),n.unsubscribe()},function(e){i(e),n.unsubscribe()})})},e.prototype.promise=function(){return this.toPromise()},e}(),State={Pending:"Pending",Fulfilled:"Fulfilled",Rejected:"Rejected"};function isFunction(e){return e&&"function"==typeof e}function isObject(e){return e&&"object"==typeof e}var TinyPromise=function(){function e(e){this._state=State.Pending,this._handlers=[],this._value=null,e(this._resolve.bind(this),this._reject.bind(this))}return e.prototype._resolve=function(t){var i=this;if(t instanceof e)t.then(this._resolve.bind(this),this._reject.bind(this));else if(isObject(t)||isFunction(t)){var n=!1;try{var r=t.then;isFunction(r)?r.call(t,function(e){n||i._resolve(e),n=!0},function(e){n||i._reject(e),n=!0}):this._fulfill(t)}catch(e){n||this._reject(e)}}else this._fulfill(t)},e.prototype._fulfill=function(e){var t=this;this._state=State.Fulfilled,this._value=e,this._handlers.forEach(function(e){return t._callHandler(e)})},e.prototype._reject=function(e){var t=this;this._state=State.Rejected,this._value=e,this._handlers.forEach(function(e){return t._callHandler(e)})},e.prototype._isPending=function(){return this._state===State.Pending},e.prototype._isFulfilled=function(){return this._state===State.Fulfilled},e.prototype._isRejected=function(){return this._state===State.Rejected},e.prototype._addHandler=function(e,t){this._handlers.push({onFulfilled:e,onRejected:t})},e.prototype._callHandler=function(e){this._isFulfilled()&&isFunction(e.onFulfilled)?e.onFulfilled(this._value):this._isRejected()&&isFunction(e.onRejected)&&e.onRejected(this._value)},e.prototype.then=function(t,i){var n=this;switch(this._state){case State.Pending:return new e(function(e,r){n._addHandler(function(i){nextTick(function(){try{isFunction(t)?e(t(i)):e(i)}catch(e){r(e)}})},function(t){nextTick(function(){try{isFunction(i)?e(i(t)):r(t)}catch(e){r(e)}})})});case State.Fulfilled:return new e(function(e,i){nextTick(function(){try{isFunction(t)?e(t(n._value)):e(n._value)}catch(e){i(e)}})});case State.Rejected:return new e(function(e,t){nextTick(function(){try{isFunction(i)?e(i(n._value)):t(n._value)}catch(e){t(e)}})})}},e}(),Promise$1="undefined"!=typeof Promise?Promise:TinyPromise,serverOnlyRequire;try{serverOnlyRequire=eval("require")}catch(e){serverOnlyRequire=function(){return null}}var serverOnlyRequire$1=serverOnlyRequire;function promiseResolve(e){return new Promise$1(function(t){return t(e)})}function tinyFetch(e,t){return void 0===t&&(t={}),new Promise$1(function(i,n){var r=new XMLHttpRequest;if(r.open(t.method||"get",e,!0),t.headers)for(var o in t.headers)r.setRequestHeader(o,t.headers[o]);function s(){var e=[],t=[],i={},n=void 0;return r.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(r,o,s){var a=o;return e.push(a=a.toLowerCase()),t.push([a,s]),n=i[a],i[a]=n?n+","+s:s,""}),{ok:2==(r.status/100|0),status:r.status,statusText:r.statusText,url:r.responseURL,clone:s,text:function(){return promiseResolve(r.responseText)},json:function(){return promiseResolve(r.responseText).then(JSON.parse)},blob:function(){return promiseResolve(new Blob([r.response]))},headers:{keys:function(){return e},entries:function(){return t},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}}r.withCredentials="include"===t.credentials,r.onload=function(){i(s())},r.onerror=n,r.send(t.body)})}var fetch="object"==typeof global&&"function"==typeof global.fetch?global.fetch:"undefined"==typeof window?serverOnlyRequire$1("node-fetch"):void 0!==window.fetch?window.fetch:tinyFetch;function assign(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var n=Object(e),r=1;r<arguments.length;r++){var o=arguments[r];if(null!=o)for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(n[s]=o[s])}return n}function throttle(e,t,i){var n,r,o;void 0===i&&(i={});var s=null,a=0,u=function(){a=!1===i.leading?0:Date.now(),s=null,o=e.apply(n,r),s||(n=r=null)};return function(){var c=Date.now();a||!1!==i.leading||(a=c);var d=t-(c-a);return n=this,r=arguments,d<=0||d>t?(s&&(clearTimeout(s),s=null),a=c,o=e.apply(n,r),s||(n=r=null)):s||!1===i.trailing||(s=setTimeout(u,d)),o}}var camelCaseToKebabCase=function(e){return e?e.replace(/([A-Z])/g,function(e){return"-"+e[0].toLowerCase()}):""},Animator=function(){function e(){}return e.prototype.bindAnimations=function(e){for(var t=0,i=e;t<i.length;t++){var n=i[t];switch(n.trigger){case"pageLoad":this.triggerAnimation(n);break;case"hover":this.bindHoverAnimation(n);break;case"scrollInView":this.bindScrollInViewAnimation(n)}}},e.prototype.warnElementNotPresent=function(e){console.warn("Cannot animate element: element with ID "+e+" not found!")},e.prototype.augmentAnimation=function(e,t){for(var i=this.getAllStylesUsed(e),n=getComputedStyle(t),r=0,o=[e.steps[0].styles,e.steps[e.steps.length-1].styles];r<o.length;r++)for(var s=o[r],a=0,u=i;a<u.length;a++){var c=u[a];c in s||(s[c]=n[c])}},e.prototype.getAllStylesUsed=function(e){for(var t=[],i=0,n=e.steps;i<n.length;i++){var r=n[i];for(var o in r.styles)-1===t.indexOf(o)&&t.push(o)}return t},e.prototype.triggerAnimation=function(e){var t=this,i=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));i.length?Array.from(i).forEach(function(i){t.augmentAnimation(e,i),i.style.transition="none",i.style.transitionDelay="0",assign(i.style,e.steps[0].styles),setTimeout(function(){i.style.transition="all "+e.duration+"s "+camelCaseToKebabCase(e.easing),e.delay&&(i.style.transitionDelay=e.delay+"s"),assign(i.style,e.steps[1].styles),setTimeout(function(){i.style.transition="",i.style.transitionDelay=""},1e3*(e.delay||0)+1e3*e.duration+100)})}):this.warnElementNotPresent(e.elementId||e.id||"")},e.prototype.bindHoverAnimation=function(e){var t=this,i=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));i.length?Array.from(i).forEach(function(i){t.augmentAnimation(e,i);var n=e.steps[0].styles,r=e.steps[1].styles;function o(){assign(i.style,n)}o(),i.addEventListener("mouseenter",function(){assign(i.style,r)}),i.addEventListener("mouseleave",o),setTimeout(function(){i.style.transition="all "+e.duration+"s "+camelCaseToKebabCase(e.easing),e.delay&&(i.style.transitionDelay=e.delay+"s")})}):this.warnElementNotPresent(e.elementId||e.id||"")},e.prototype.bindScrollInViewAnimation=function(e){var t=this,i=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));i.length?Array.from(i).forEach(function(i){t.augmentAnimation(e,i);var n=!1;function r(){var t,r,s;!n&&(t=i.getBoundingClientRect(),r=window.innerHeight,s=0*r,t.bottom>s&&t.top<r-s)&&(n=!0,setTimeout(function(){assign(i.style,e.steps[1].styles),document.removeEventListener("scroll",o),setTimeout(function(){i.style.transition="",i.style.transitionDelay=""},1e3*(1e3*e.duration+(e.delay||0))+100)}))}var o=throttle(r,200,{leading:!1});var s=e.steps[0].styles;assign(i.style,s),setTimeout(function(){i.style.transition="all "+e.duration+"s "+camelCaseToKebabCase(e.easing),e.delay&&(i.style.transitionDelay=e.delay+"s")}),document.addEventListener("scroll",o,{capture:!0,passive:!0}),r()}):this.warnElementNotPresent(e.elementId||e.id||"")},e}();function getTopLevelDomain(e){var t=e.split(".");return t.length>2?t.slice(1).join("."):e}var fieldContentRegExp=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Cookies=function(){function e(e,t){this.request=e,this.response=t}return e.prototype.get=function(e){var t=this.request.headers.cookie;if(t){var i=t.match(getPattern(e));if(i)return i[1]}},e.prototype.set=function(e,t,i){var n=this.response,r=this.request,o=n.getHeader("Set-Cookie")||[],s=void 0!==this.secure?!!this.secure:"https"===r.protocol||r.connection.encrypted,a=new Cookie(e,t,i);if("string"==typeof o&&(o=[o]),!s&&i&&i.secure)throw new Error("Cannot send secure cookie over unencrypted connection");return a.secure=s,i&&"secure"in i&&(a.secure=!!i.secure),a.domain=r.headers.host&&getTopLevelDomain(r.headers.host),pushCookie(o,a),n.setHeader.call(n,"Set-Cookie",o),this},e}(),Cookie=function(){function e(e,t,i){if(this.path="/",this.domain=void 0,this.httpOnly=!0,this.sameSite=!1,this.secure=!1,this.overwrite=!1,this.name="",this.value="",!fieldContentRegExp.test(e))throw new TypeError("argument name is invalid");if(t&&!fieldContentRegExp.test(t))throw new TypeError("argument value is invalid");t||(this.expires=new Date(0)),this.name=e,this.value=t||"",i.expires&&(this.expires=i.expires),i.secure&&(this.secure=i.secure)}return e.prototype.toString=function(){return this.name+"="+this.value},e.prototype.toHeader=function(){var e=this.toString();return this.maxAge&&(this.expires=new Date(Date.now()+this.maxAge)),this.path&&(e+="; path="+this.path),this.expires&&(e+="; expires="+this.expires.toUTCString()),this.domain&&(e+="; domain="+this.domain),e+="; SameSite="+(!0===this.sameSite?"strict":"None"),this.secure&&(e+="; secure"),this.httpOnly&&(e+="; httponly"),e},e}();function getPattern(e){return new RegExp("(?:^|;) *"+e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")+"=([^;]*)")}function pushCookie(e,t){if(t.overwrite)for(var i=e.length-1;i>=0;i--)0===e[i].indexOf(t.name+"=")&&e.splice(i,1);e.push(t.toHeader())}function omit(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var n=Object.assign({},e),r=0,o=t;r<o.length;r++){delete n[o[r]]}return n}function uuidv4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})}function uuid(){return uuidv4().replace(/-/g,"")}function pad(e,t){for(;e.length<t;)e="0"+e;return e}function fold(e,t){var i,n;if(0===t.length)return e;for(i=0,n=t.length;i<n;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return e<0?-2*e:e}function foldObject(e,t,i){return Object.keys(t).sort().reduce(function(e,n){return foldValue(e,t[n],n,i)},e)}function foldValue(e,t,i,n){var r=fold(fold(fold(e,i),toString(t)),typeof t);if(null===t)return fold(r,"null");if(void 0===t)return fold(r,"undefined");if("object"==typeof t||"function"==typeof t){if(-1!==n.indexOf(t))return fold(r,"[Circular]"+i);n.push(t);var o=foldObject(r,t,n);if(!("valueOf"in t)||"function"!=typeof t.valueOf)return o;try{return fold(o,String(t.valueOf()))}catch(e){return fold(o,"[valueOf exception]"+(e.stack||e.message))}}return fold(r,t.toString())}function toString(e){return Object.prototype.toString.call(e)}function sum(e){return pad(foldValue(0,e,"",[]).toString(16),8)}var hashSum=sum;function datePlusMinutes(e){return void 0===e&&(e=30),new Date(Date.now()+6e4*e)}var isPositiveNumber=function(e){return"number"==typeof e&&!isNaN(e)&&e>=0},isReactNative="object"==typeof navigator&&"ReactNative"===navigator.product,validEnvList=["production","qa","test","development","dev","cdn-qa","cloud","fast","cdn2","cdn-prod"];function getQueryParam(e,t){for(var i=(e.split("?")[1]||"").split("&"),n=0;n<i.length;n++){var r=i[n].split("=");if(decodeURIComponent(r[0])===t)return decodeURIComponent(r[1])}return null}var urlParser={parse:function(e){var t=document.createElement("a");t.href=e;for(var i={},n="username password host hostname port protocol origin pathname search hash".split(" "),r=n.length;r--;)i[n[r]]=t[n[r]];return!i.pathname&&""!==i.pathname||"string"!=typeof i.pathname||0===i.pathname.indexOf("/")||(i.pathname="/"+i.pathname),i}},parse=isReactNative?function(){return{}}:"object"==typeof window?urlParser.parse:serverOnlyRequire$1("url").parse;function setCookie(e,t,i){try{var n="";i&&(n="; expires="+i.toUTCString());var r=!isBrowser||"https:"===location.protocol;document.cookie=e+"="+(t||"")+n+"; path=/; domain="+getTopLevelDomain(location.hostname)+(r?";secure ; SameSite=None":"")}catch(e){console.warn("Could not set cookie",e)}}function getCookie(e){try{return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null}catch(e){console.warn("Could not get cookie",e)}}function size(e){return Object.keys(e).length}function find(e,t){for(var i=e,n=i.length>>>0,r=arguments[1],o=0;o<n;o++){var s=i[o];if(t.call(r,s,o,i))return s}}var sessionStorageKey="builderSessionId",localStorageKey="builderVisitorId",isBrowser="undefined"!=typeof window&&!isReactNative,isIframe=isBrowser&&window.top!==window.self;function BuilderComponent(e){return void 0===e&&(e={}),Builder.Component(e)}var Builder=function(){function e(t,i,n,r,o){var s=this;if(void 0===t&&(t=null),void 0===r&&(r=!1),void 0===o&&(o=null),this.request=i,this.response=n,this.eventsQueue=[],this.throttledClearEventsQueue=throttle(function(){s.processEventsQueue(),s.setCookie(sessionStorageKey,s.sessionId,datePlusMinutes(30))},5),this.env="production",this.sessionId=this.getSessionId(),this.targetContent=!0,this.contentPerRequest=1,this.allowCustomFonts=!0,this.cookies=null,this.cachebust=!1,this.overrideParams="",this.noCache=!1,this.preview=!1,this.canTrack$=new BehaviorSubject(!this.browserTrackingDisabled),this.apiKey$=new BehaviorSubject(null),this.authToken$=new BehaviorSubject(null),this.userAttributesChanged=new BehaviorSubject(null),this.editingMode$=new BehaviorSubject(isIframe),this.editingModel$=new BehaviorSubject(null),this.userAgent="object"==typeof navigator&&navigator.userAgent||"",this.trackingHooks=[],this.visitorId=this.getVisitorId(),this.autoTrack=!!e.isBrowser&&!(this.isDevelopmentEnv||e.isBrowser&&-1!==location.search.indexOf("builder.preview=")),this.trackingUserAttributes={},this.blockContentLoading="",this.observersByKey={},this.noEditorUpdates={},this.overrides={},this.getContentQueue=null,this.priorContentQueue=null,this.testCookiePrefix="builder.tests",this.cookieQueue=[],e.isBrowser&&!r&&e.singletonInstance)return e.singletonInstance;this.request&&this.response&&(this.setUserAgent(this.request.headers["user-agent"]||""),this.cookies=new Cookies(this.request,this.response)),t&&(this.apiKey=t),o&&(this.authToken=o),isBrowser&&this.bindMessageListeners(),isIframe&&this.messageFrameLoaded(),this.canTrack$.subscribe(function(e){if(e){if("undefined"!=typeof sessionStorage)try{sessionStorage.getItem(sessionStorageKey)||sessionStorage.setItem(sessionStorageKey,s.sessionId)}catch(e){console.debug("Session storage error",e)}s.eventsQueue.length&&s.throttledClearEventsQueue(),s.cookieQueue.length&&(s.cookieQueue.forEach(function(e){s.setCookie(e[0],e[1])}),s.cookieQueue.length=0)}}),isBrowser&&(this.setTestsFromUrl(),this.getOverridesFromQueryString())}return e.register=function(t,i){var n=this.registry[t];if(n||(n=this.registry[t]=[]),n.push(i),e.isBrowser){var r={type:"builder.register",data:{type:t,info:i}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(e){console.debug("Could not postmessage",e)}}this.registryChange.next(this.registry)},e.registerEditor=function(t){if(e.isBrowser){window.postMessage({type:"builder.registerEditor",data:omit(t,"component")},"*");var i=location.hostname;e.isTrustedHost(i)||console.error("Builder.registerEditor() called in the wrong environment! You cannot load custom editors from your app, they must be loaded through the Builder.io app itself. Follow the readme here for more details: https://github.com/builderio/builder/tree/master/plugins/cloudinary or contact chat us in our Spectrum community for help: https://spectrum.chat/builder")}this.editors.push(t)},e.registerPlugin=function(e){this.plugins.push(e)},e.registerAction=function(e){this.actions.push(e)},e.registerTrustedHost=function(e){this.trustedHosts.push(e)},e.isTrustedHost=function(e){return this.trustedHosts.findIndex(function(t){return t===e||e.endsWith("."+t)})>-1},e.runAction=function(e){if(!("string"==typeof e?find(this.actions,function(t){return t.name===e}):e))throw new Error("Action not found: "+e)},e.fields=function(e,t){var i;null===(i=window.parent)||void 0===i||i.postMessage({type:"builder.fields",data:{name:e,fields:t}},"*")},e.set=function(t){if(e.isBrowser){Object.assign(this.settings,t);var i={type:"builder.settingsChange",data:this.settings};parent.postMessage(i,"*")}this.settingsChange.next(this.settings)},e.import=function(t){if(e.isBrowser){var i=window.System;if(i)return i.import("https://cdn.builder.io/systemjs/"+t);console.warn("System.js not available. Please include System.js when using Builder.import")}else console.warn("Builder.import used on the server - this should only be used in the browser")},Object.defineProperty(e,"editingPage",{get:function(){return this._editingPage},set:function(e){this._editingPage=e,isBrowser&&isIframe&&(e?document.body.classList.add("builder-editing-page"):document.body.classList.remove("builder-editing-page"))},enumerable:!0,configurable:!0}),e.prepareComponentSpecToSend=function(e){return __assign(__assign(__assign({},e),e.inputs&&{inputs:e.inputs.map(function(e){for(var t,i=0,n=["onChange","showIf"];i<n.length;i++){var r=n[i];if(e[r]&&"function"==typeof e[r]){var o=e[r];e=__assign(__assign({},e),((t={})[r]="return ("+o.toString()+").apply(this, arguments)",t))}}return e})}),{hooks:Object.keys(e.hooks||{}).reduce(function(t,i){var n=e.hooks&&e.hooks[i];return n?(t[i]="string"==typeof n?n:"return ("+n.toString()+").apply(this, arguments)",t):t},{}),class:void 0})},e.registerBlock=function(e,t){this.registerComponent(e,t)},e.registerComponent=function(e,t){var i,n=__assign(__assign({class:e},e.builderOptions),t);if(this.addComponent(n),t.models&&this.singletonInstance.editingModel?isBrowser&&t.models.includes(this.singletonInstance.editingModel):isBrowser){var r=this.prepareComponentSpecToSend(n);null===(i=window.parent)||void 0===i||i.postMessage({type:"builder.registerComponent",data:r},"*")}},e.addComponent=function(e){var t=find(this.components,function(t){return t.name===e.name});if(t){if(t.class&&!e.class)return;this.components.splice(this.components.indexOf(t),1,e)}else this.components.push(e)},e.component=function(e){var t=this;return void 0===e&&(e={}),function(i){var n,r=__assign(__assign({},e),{class:i});r.name||(r.name=i.name),t.addComponent(r);var o=t.prepareComponentSpecToSend(r);return isBrowser&&(null===(n=window.parent)||void 0===n||n.postMessage({type:"builder.registerComponent",data:o},"*")),i}},Object.defineProperty(e,"Component",{get:function(){return this.component},enumerable:!0,configurable:!0}),e.prototype.processEventsQueue=function(){if(this.eventsQueue.length){var t=this.eventsQueue;this.eventsQueue=[];for(var i=__assign(__assign({},e.overrideUserAttributes),this.trackingUserAttributes),n=0,r=t;n<r.length;n++){var o=r[n];o.data.metadata||(o.data.metadata={}),o.data.metadata.user||(o.data.metadata.user={}),Object.assign(o.data.metadata.user,i,o.data.metadata.user)}var s=this.host;fetch(s+"/api/v1/track",{method:"POST",body:JSON.stringify({events:t}),headers:{"content-type":"application/json"},mode:"cors"}).catch(function(){})}},Object.defineProperty(e.prototype,"browserTrackingDisabled",{get:function(){return Boolean(e.isBrowser&&window.builderNoTrack)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canTrack",{get:function(){return this.canTrack$.value},set:function(e){this.canTrack!==e&&this.canTrack$.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editingMode",{get:function(){return this.editingMode$.value},set:function(e){e!==this.editingMode&&this.editingMode$.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editingModel",{get:function(){return this.editingModel$.value},set:function(e){e!==this.editingModel&&this.editingModel$.next(e)},enumerable:!0,configurable:!0}),e.prototype.findParentElement=function(e,t,i){if(void 0===i&&(i=!0),!(e instanceof HTMLElement))return null;var n=i?e:e.parentElement;do{if(!n)return null;if(t(n))return n}while(n=n.parentElement);return null},e.prototype.findBuilderParent=function(e){return this.findParentElement(e,function(e){var t=e.getAttribute("builder-id")||e.id;return Boolean(t&&0===t.indexOf("builder-"))})},e.prototype.setUserAgent=function(e){this.userAgent=e||""},e.prototype.setTrackingHook=function(e){this.trackingHooks.push(e)},e.prototype.track=function(t,i,n){if(void 0===i&&(i={}),!isIframe&&isBrowser&&!e.isPreviewing){var r=this.apiKey;if(r){for(var o=JSON.parse(JSON.stringify({type:t,data:__assign(__assign({},omit(i,"meta")),{metadata:__assign(__assign({sdkVersion:e.VERSION,url:location.href},i.meta),i.metadata),ownerId:r,userAttributes:this.getUserAttributes(),sessionId:this.sessionId,visitorId:this.visitorId})})),s=0,a=this.trackingHooks;s<a.length;s++){var u=(0,a[s])(o,n||{});u&&(o=u)}this.eventsQueue.push(o),this.canTrack&&this.throttledClearEventsQueue()}else console.error('Builder integration error: Looks like the Builder SDK has not been initialized properly (your API key has not been set). Make sure you are calling `builder.init("«YOUR-API-KEY»");` as early as possible in your application\'s code.')}},e.prototype.getSessionId=function(){var t=this,i=null;try{e.isBrowser&&"undefined"!=typeof sessionStorage&&(i=this.getCookie(sessionStorageKey))}catch(e){console.debug("Session storage error",e)}return i||(i=uuid()),e.isBrowser&&setTimeout(function(){try{t.canTrack&&t.setCookie(sessionStorageKey,i,datePlusMinutes(30))}catch(e){console.debug("Cookie setting error",e)}}),i},e.prototype.getVisitorId=function(){var t=this;if(this.visitorId)return this.visitorId;var i=null;try{e.isBrowser&&"undefined"!=typeof localStorage&&(i=localStorage.getItem(localStorageKey))}catch(e){console.debug("Local storage error",e)}return i||(i=uuid()),this.visitorId=i,e.isBrowser&&setTimeout(function(){try{t.canTrack&&"undefined"!=typeof localStorage&&i&&localStorage.setItem(localStorageKey,i)}catch(e){console.debug("Session storage error",e)}}),i},e.prototype.trackImpression=function(t,i,n,r){isIframe||!isBrowser||e.isPreviewing||this.track("impression",{contentId:t,variationId:i!==t?i:void 0,metadata:n},r)},e.prototype.trackConversion=function(t,i,n,r,o){if(!isIframe&&isBrowser&&!e.isPreviewing){var s="object"==typeof i?i:r,a="string"==typeof i?i:void 0;this.track("conversion",{amount:t,variationId:n,meta:s,contentId:a},o)}},Object.defineProperty(e.prototype,"isDevelopmentEnv",{get:function(){return e.isIframe||e.isBrowser&&("localhost"===location.hostname||""!==location.port)||"production"!==this.env},enumerable:!0,configurable:!0}),e.prototype.trackInteraction=function(t,i,n,r,o){if(void 0===n&&(n=!1),!isIframe&&isBrowser&&!e.isPreviewing){var s=r&&r.target,a=s&&this.findBuilderParent(s),u={};if(r){var c=r.clientX,d=r.clientY;if(s){var l=c-(g=s.getBoundingClientRect()).left,h=d-g.top,p=y(l/g.width),f=y(h/g.height);u.targetOffset={x:p,y:f}}if(a){var g;l=c-(g=a.getBoundingClientRect()).left,h=d-g.top,p=y(l/g.width),f=y(h/g.height);u.builderTargetOffset={x:p,y:f}}}var v=a&&(a.getAttribute("builder-id")||a.id);v&&a&&(u.builderElementIndex=[].slice.call(document.getElementsByClassName(v)).indexOf(a)),this.track("click",{contentId:t,metadata:u,variationId:i!==t?i:void 0,unique:!n,targetBuilderElement:v||void 0},o)}function y(e){return Math.round(1e3*e)/1e3}},e.prototype.component=function(t){return void 0===t&&(t={}),e.component(t)},Object.defineProperty(e.prototype,"apiKey",{get:function(){return this.apiKey$.value},set:function(e){this.apiKey$.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"authToken",{get:function(){return this.authToken$.value},set:function(e){this.authToken$.next(e)},enumerable:!0,configurable:!0}),e.prototype.modifySearch=function(e){return e.replace(/(^|&|\?)(builder_.*?)=/gi,function(e,t,i){return t+i.replace(/_/g,".")+"="})},e.prototype.setTestsFromUrl=function(){var e=this.getLocation().search,t=QueryString.parseDeep(this.modifySearch(e||"").substr(1)),i=t.builder&&t.builder.tests;if(i&&"object"==typeof i)for(var n in i)i.hasOwnProperty(n)&&this.setTestCookie(n,i[n])},e.prototype.resetOverrides=function(){e.overrideUserAttributes={},this.cachebust=!1,this.noCache=!1,this.preview=!1,this.editingModel=null,this.overrides={},this.env="production",this.userAgent="",this.request=void 0,this.response=void 0},e.prototype.getOverridesFromQueryString=function(){var t=this.getLocation(),i=QueryString.parseDeep(this.modifySearch(t.search||"").substr(1)),n=i.builder;if(n){var r=n.userAttributes,o=n.overrides,s=n.env,a=(n.host,n.api),u=n.cachebust,c=n.noCache,d=n.preview,l=n.editing,h=n.frameEditing,p=n.params;if(r&&this.setUserAttributes(r),o&&(this.overrides=o),validEnvList.indexOf(s||a)>-1&&(this.env=s||a),e.isEditing){var f=h||l||d;f&&"true"!==f&&(this.editingModel=f)}u&&(this.cachebust=!0),c&&(this.noCache=!0),d&&(this.preview=!0),i&&(this.overrideParams=p)}},e.prototype.messageFrameLoaded=function(){var e;null===(e=window.parent)||void 0===e||e.postMessage({type:"builder.loaded",data:{value:!0}},"*")},e.prototype.bindMessageListeners=function(){var t=this;isBrowser&&addEventListener("message",function(i){var n,r,o,s,a,u=parse(i.origin),c=-1===["builder.register","builder.registerComponent"].indexOf(null===(n=i.data)||void 0===n?void 0:n.type),d=u.hostname&&e.isTrustedHost(u.hostname);if(!c||d){var l=i.data;if(l)switch(l.type){case"builder.ping":null===(r=window.parent)||void 0===r||r.postMessage({type:"builder.pong",data:{}},"*");break;case"builder.register":if(i.source===window)break;var h=l.data;if(!h)break;var p=h.type,f=h.info,g=e.registry[p];g||(g=e.registry[p]=[]),g.push(f),e.registryChange.next(e.registry);break;case"builder.settingsChange":if(i.source===window)break;var v=l.data;if(!v)break;Object.assign(e.settings,v),e.settingsChange.next(e.settings);break;case"builder.registerEditor":if(i.source===window)break;var y=l.data;if(!y)break;var m=!!y.component;e.editors.every(function(t,i){return y.name!==t.name||!(t.component&&!m)&&(e.editors[i]=t,!1)});break;case"builder.triggerAnimation":e.animator.triggerAnimation(l.data);break;case"builder.contentUpdate":var b=l.data.key||l.data.alias||l.data.entry||l.data.modelName,w=l.data.data,k=t.observersByKey[b];k&&!t.noEditorUpdates[b]&&k.next([w]);break;case"builder.getComponents":null===(o=window.parent)||void 0===o||o.postMessage({type:"builder.components",data:e.components.map(function(t){return e.prepareComponentSpecToSend(t)})},"*");break;case"builder.editingModel":t.editingModel=l.data.model;break;case"builder.registerComponent":var C=l.data;e.addComponent(C);break;case"builder.blockContentLoading":"string"==typeof l.data.model&&(t.blockContentLoading=l.data.model);break;case"builder.editingMode":l.data?(t.editingMode=!0,document.body.classList.add("builder-editing")):(t.editingMode=!1,document.body.classList.remove("builder-editing"));break;case"builder.editingPageMode":var S=l.data;e.editingPage=S;break;case"builder.overrideUserAttributes":var _=l.data;assign(e.overrideUserAttributes,_),t.flushGetContentQueue(!0);break;case"builder.overrideTestGroup":var x=l.data,T=x.variationId,B=x.contentId;T&&B&&(t.setTestCookie(B,T),t.flushGetContentQueue(!0));break;case"builder.evaluate":var O=l.data.text,P=l.data.arguments||[],I=l.data.id,E=new Function(O),A=void 0,j=null;try{A=E.apply(t,P)}catch(e){j=e}j?null===(s=window.parent)||void 0===s||s.postMessage({type:"builder.evaluateError",data:{id:I,error:j.message}},"*"):A&&"function"==typeof A.then?A.then(function(e){var t;null===(t=window.parent)||void 0===t||t.postMessage({type:"builder.evaluateResult",data:{id:I,result:e}},"*")}).catch(console.error):null===(a=window.parent)||void 0===a||a.postMessage({type:"builder.evaluateResult",data:{result:A,id:I}},"*")}}})},Object.defineProperty(e.prototype,"defaultCanTrack",{get:function(){return Boolean(e.isBrowser&&navigator.userAgent.trim()&&!navigator.userAgent.match(/bot|crawler|spider|robot|crawling|prerender|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|phantom|headless|selenium|puppeteer/i)&&!this.browserTrackingDisabled)},enumerable:!0,configurable:!0}),e.prototype.init=function(e,t,i,n,r){return void 0===t&&(t=this.defaultCanTrack),i&&(this.request=i),n&&(this.response=n),this.canTrack=t,this.apiKey=e,r&&(this.authToken=r),this},Object.defineProperty(e.prototype,"previewingModel",{get:function(){var e=this.getLocation().search;return QueryString.parse((e||"").substr(1))["builder.preview"]},enumerable:!0,configurable:!0}),e.prototype.getLocation=function(){var e={};return this.request?e=parse(this.request.url):"object"==typeof location&&(e=parse(location.href)),""===e.pathname&&(e.pathname="/"),e},e.prototype.getUserAttributes=function(t){void 0===t&&(t=this.userAgent||"");var i={Android:function(){return t.match(/Android/i)},BlackBerry:function(){return t.match(/BlackBerry/i)},iOS:function(){return t.match(/iPhone|iPod/i)},Opera:function(){return t.match(/Opera Mini/i)},Windows:function(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any:function(){return i.Android()||i.BlackBerry()||i.iOS()||i.Opera()||i.Windows()}},n=t.match(/Tablet|iPad/i),r=this.getLocation();return __assign({urlPath:r.pathname,host:r.host||r.hostname,device:n?"tablet":i.any()?"mobile":"desktop"},e.overrideUserAttributes)},e.prototype.setUserAttributes=function(t){assign(e.overrideUserAttributes,t),this.userAttributesChanged.next(t)},e.prototype.setTrackingUserAttributes=function(e){assign(this.trackingUserAttributes,e)},e.prototype.get=function(t,i){void 0===i&&(i={});var n=this;return e.isBrowser?(i.apiKey&&!this.apiKey&&(this.apiKey=i.apiKey),i.authToken&&!this.authToken&&(this.authToken=i.authToken)):(n=new e(i.apiKey||this.apiKey,i.req,i.res,void 0,i.authToken||this.authToken)).setUserAttributes(this.getUserAttributes()),n.queueGetContent(t,i).map(function(t){var i=t&&t[0];if(e.isStatic)return i;var n=i&&i.data;return n?(void 0!==n.blocksString&&(n.blocks=JSON.parse(n.blocksString),delete n.blocksString),{data:n,id:i.id,variationId:i.testVariationId||i.variationId||null,testVariationId:i.testVariationId||i.variationId||null,testVariationName:i.testVariationName||null,lastUpdated:i.lastUpdated||null}):null})},e.prototype.queueGetContent=function(t,i){var n=this;void 0===i&&(i={});var r=i.key||i.alias||t,o=this.editingModel===t,s=this.observersByKey[r];"DEMO"!==this.apiKey||this.overrides[r]||i.initialContent||(i.initialContent=[]);var a=i.initialContent;if(s&&(!s.value||i.cache))return s.value&&nextTick(function(){s.next(s.value)}),s;if(o&&e.isBrowser&&parent.postMessage({type:"builder.updateContent",data:{options:i}},"*"),!a)if(this.getContentQueue||(this.getContentQueue=[]),this.getContentQueue.push(__assign(__assign({},i),{model:t,key:r})),this.getContentQueue&&this.getContentQueue.length>=this.contentPerRequest){var u=this.getContentQueue.slice();this.getContentQueue=[],nextTick(function(){n.flushGetContentQueue(!1,u)})}else nextTick(function(){n.flushGetContentQueue()});var c=new BehaviorSubject(null);return this.observersByKey[r]=c,i.noEditorUpdates&&(this.noEditorUpdates[r]=!0),a&&nextTick(function(){c.next(a)}),c},e.prototype.requestUrl=function(t,i){return e.isBrowser?fetch(t,i).then(function(e){return e.json()}):new Promise(function(e,n){var r=parse(t),o="http:"===r.protocol?serverOnlyRequire$1("http"):serverOnlyRequire$1("https"),s={host:r.hostname,port:r.port,path:r.pathname+r.search,headers:__assign({},null===i||void 0===i?void 0:i.headers)};o.get(s,function(t){var i="";t.setEncoding("utf8"),t.on("data",function(e){i+=e}),t.on("end",function(){try{e(JSON.parse(i))}catch(e){n(e)}})}).on("error",function(e){n(e)})})},Object.defineProperty(e.prototype,"host",{get:function(){switch(this.env){case"qa":return"https://qa.builder.io";case"test":return"https://builder-io-test.web.app";case"fast":return"https://fast.builder.io";case"cloud":return"https://cloud.builder.io";case"cdn2":return"https://cdn2.builder.io";case"cdn-qa":return"https://cdn-qa.builder.io";case"development":case"dev":return"http://localhost:5000";case"cdn-prod":return"https://cdn.builder.io";default:return e.overrideHost||"https://cdn.builder.io"}},enumerable:!0,configurable:!0}),e.prototype.flushGetContentQueue=function(t,i){var n=this;if(void 0===t&&(t=!1),!this.apiKey)throw new Error("Fetching content failed, expected apiKey to be defined instead got: "+this.apiKey);if(t||this.getContentQueue){var r=i||(t?this.priorContentQueue:this.getContentQueue)||[];this.getOverridesFromQueryString();var o=__assign({omit:r[0].omit||"meta.componentsUsed",apiKey:this.apiKey},r[0].options);r[0].fields&&(o.fields=r[0].fields),r[0].format&&(o.format=r[0].format);var s="undefined"!=typeof location?QueryString.parseDeep(location.search.substr(1)):{},a=r&&r[0].userAttributes?r[0].userAttributes:this.targetContent?this.getUserAttributes():{urlPath:this.getLocation().pathname};if(r.find(function(e){return!!e.includeUrl})){var u=this.getLocation();u.origin&&(o.url=""+u.origin+u.pathname+u.search)}var c=null===i||void 0===i?void 0:i.find(function(e){return e.url});if((null===c||void 0===c?void 0:c.url)&&(a.urlPath=c.url.split("?")[0]),o.userAttributes=a,t||i||(this.priorContentQueue=r,this.getContentQueue=null),(this.cachebust||isIframe||s.cachebust||s["builder.cachebust"]||"production"!==this.env)&&(o.cachebust=!0),e.isEditing&&(o.isEditing=!0),(this.noCache||"production"!==this.env)&&(o.noCache=!0),size(this.overrides))for(var d in this.overrides)this.overrides.hasOwnProperty(d)&&(o["overrides."+d]=this.overrides[d]);e.isReact||(o.prerender=!0);for(var l=0,h=r;l<h.length;l++){var p=h[l];p.format&&(o.format=p.format),p.static&&(o.static=p.static),p.cachebust&&(o.cachebust=p.cachebust),isPositiveNumber(p.cacheSeconds)&&(o.cacheSeconds=p.cacheSeconds),isPositiveNumber(p.staleCacheSeconds)&&(o.staleCacheSeconds=p.staleCacheSeconds);for(var f=0,g=["prerender","extractCss","limit","offset","query","preview","model","entry","rev","static"];f<g.length;f++){var v=p[d=g[f]];void 0!==v&&(o.options=o.options||{},o.options[p.key]=o.options[p.key]||{},o.options[p.key][d]=JSON.stringify(v))}}this.preview&&(o.preview="true");var y=Object.keys(o).length>0,m=this.host,b=r.map(function(e){return encodeURIComponent(e.key)}).join(",");if(this.overrideParams)assign(o,omit(QueryString.parse(this.overrideParams),"apiKey"));var w=QueryString.stringifyDeep(o),k=o.format,C={headers:{}};return this.authToken&&(C.headers=__assign(__assign({},C.headers),{Authorization:"Bearer "+this.authToken})),this.requestUrl(m+"/api/v1/"+("solid"===k||"react"===k?"codegen":"query")+"/"+this.apiKey+"/"+b+(o&&y?"?"+w:""),C).then(function(t){for(var i=0,o=r;i<o.length;i++){var s=o[i],a=s.key;if(s.model!==n.blockContentLoading||s.noEditorUpdates){n.editingModel===s.model&&e.isEditing&&parent.postMessage({type:"builder.updateContent",data:{options:s}},"*");var u=n.observersByKey[a];if(!u)return;var c=t[a],d=c;if(c){var l=e.isServer?d:n.processResultsForTests(d);u.next(l)}else{if((n.getLocation().search||"").includes("builder.preview="+s.model)){u.next([{id:"preview",name:"Preview",data:{}}])}u.next([])}}}},function(e){for(var t=0,i=r;t<i.length;t++){var o=i[t],s=n.observersByKey[o.key];if(!s)return;s.error(e)}})}},e.prototype.processResultsForTests=function(e){var t,i=this,n=e.map(function(e){if(!e.variations)return e;var t=i.getTestCookie(e.id),n=t===e.id?e:e.variations[t];if(n)return __assign(__assign({},e),{data:n.data,variationId:t,testVariationId:t,testVariationName:n.name});if(i.canTrack&&e.variations&&size(e.variations)){var r=0,o=Math.random();for(var s in e.variations){var a=e.variations[s];if(o<(r+=a.testRatio)){i.setTestCookie(e.id,a.id);var u=a.name||(a.id===e.id?"Default variation":"");return __assign(__assign({},e),{data:a.data,variationId:a.id,testVariationId:a.id,variationName:u,testVariationName:u})}}i.setTestCookie(e.id,e.id)}return __assign(__assign(__assign({},e),{variationId:e.id}),e.variations&&size(e.variations)&&{testVariationId:e.id,testVariationName:"Default variation"})});return isIframe&&(null===(t=window.parent)||void 0===t||t.postMessage({type:"builder.contentResults",data:{results:n}},"*")),n},e.prototype.getTestCookie=function(e){return this.getCookie(this.testCookiePrefix+"."+e)},e.prototype.setTestCookie=function(e,t){if(this.canTrack){var i=new Date;return i.setDate(i.getDate()+30),this.setCookie(this.testCookiePrefix+"."+e,t,i)}this.cookieQueue.push([e,t])},e.prototype.getCookie=function(t){return this.cookies?this.cookies.get(t):e.isBrowser&&getCookie(t)},e.prototype.setCookie=function(t,i,n){return!this.cookies||e.isServer&&e.isStatic?e.isBrowser&&setCookie(t,i,n):this.cookies.set(t,i,{expires:n,secure:"https:"===this.getLocation().protocol})},e.prototype.getContent=function(e,t){if(void 0===t&&(t={}),!this.apiKey)throw new Error("Fetching content from model "+e+" failed, expected apiKey to be defined instead got: "+this.apiKey);return this.queueGetContent(e,t)},e.prototype.getAll=function(t,i){void 0===i&&(i={});var n=this;return e.isBrowser?i.apiKey&&!this.apiKey&&(this.apiKey=i.apiKey):(n=new e(i.apiKey||this.apiKey,i.req,i.res)).setUserAttributes(this.getUserAttributes()),n.getContent(t,__assign(__assign({limit:30},i),{key:i.key||e.isBrowser?t+":"+hashSum(omit(i,"initialContent","req","res")):void 0})).promise()},e.VERSION=version,e.components=[],e.isStatic=!0,e.animator=new Animator,e.nextTick=nextTick,e.throttle=throttle,e.editors=[],e.trustedHosts=["builder.io","localhost"],e.plugins=[],e.actions=[],e.registry={},e.registryChange=new BehaviorSubject({}),e._editingPage=!1,e.isIframe=isIframe,e.isBrowser=isBrowser,e.isReactNative=isReactNative,e.isServer=!isBrowser&&!isReactNative,e.previewingModel=e.isBrowser&&getQueryParam(location.href,"builder.preview"),e.settings={},e.settingsChange=new BehaviorSubject({}),e.isEditing=Boolean(isIframe&&(document.referrer&&document.referrer.match(/builder\.io|localhost:1234/)||-1!==location.search.indexOf("builder.frameEditing="))),e.isPreviewing=Boolean(isBrowser&&(-1!==location.search.indexOf("builder.preview=")||-1!==location.search.indexOf("builder.frameEditing="))),e.isReact=!1,e.overrideUserAttributes={},e}(),builder=new Builder(null,void 0,void 0,!0);Builder.singletonInstance=builder,exports.Builder=Builder,exports.BuilderComponent=BuilderComponent,exports.isBrowser=isBrowser,exports.BehaviorSubject=BehaviorSubject,exports.Subscription=Subscription,exports.builder=builder,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define("@builder.io/sdk",["exports"],t):t(e.BuilderIO={})}(this,function(exports){"use strict";var __assign=function(){return(__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};!function(){if("undefined"==typeof window||"function"==typeof window.CustomEvent)return!1;window.CustomEvent=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i}}();var isSafari="undefined"!=typeof window&&/^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);function nextTick(e){if("function"==typeof setImmediate&&"undefined"==typeof window)return setImmediate(e);if(isSafari||"undefined"==typeof MutationObserver)setTimeout(e);else{var t=0,i=new MutationObserver(function(){return e()}),n=document.createTextNode("");i.observe(n,{characterData:!0}),n.data=String(t=++t)}}var PROPERTY_NAME_DENY_LIST=Object.freeze(["__proto__","prototype","constructor"]),QueryString=function(){function e(){}return e.parseDeep=function(e){var t=this.parse(e);return this.deepen(t)},e.stringifyDeep=function(e){var t=this.flatten(e);return this.stringify(t)},e.parse=function(e){for(var t={},i=("?"===e[0]?e.substr(1):e).split("&"),n=0;n<i.length;n++){var r=i[n].split("=");try{t[decodeURIComponent(r[0])]=decodeURIComponent(r[1]||"")}catch(e){}}return t},e.stringify=function(e){var t="";for(var i in e)if(e.hasOwnProperty(i)){var n=e[i];t&&(t+="&"),t+=encodeURIComponent(i)+"="+encodeURIComponent(n)}return t},e.deepen=function(e){var t={};for(var i in e){for(var n=t,r=i.split("."),o=r.pop(),s=0,a=r;s<a.length;s++){var u=a[s];assertAllowedPropertyName(u),n=n[u]=n[u]||{}}n[o]=e[i]}return t},e.flatten=function(e,t,i){for(var n in void 0===i&&(i={}),e){var r=e[n],o=t?t+"."+n:n;r&&"object"==typeof r?this.flatten(r,o,i):i[o]=r}return i},e}();function assertAllowedPropertyName(e){if(PROPERTY_NAME_DENY_LIST.indexOf(e)>=0)throw new Error('Property name "'.concat(e,'" is not allowed'))}var version="1.1.27-0",Subscription=function(){function e(e,t){this.listeners=e,this.listener=t,this.unsubscribed=!1,this.otherSubscriptions=[]}return Object.defineProperty(e.prototype,"closed",{get:function(){return this.unsubscribed},enumerable:!1,configurable:!0}),e.prototype.add=function(e){this.otherSubscriptions.push(e)},e.prototype.unsubscribe=function(){if(!this.unsubscribed){if(this.listener&&this.listeners){var e=this.listeners.indexOf(this.listener);e>-1&&this.listeners.splice(e,1)}this.otherSubscriptions.forEach(function(e){return e.unsubscribe()}),this.unsubscribed=!0}},e}(),BehaviorSubject=function(){function e(e){this.value=e,this.listeners=[],this.errorListeners=[]}return e.prototype.next=function(e){this.value=e;for(var t=0,i=this.listeners;t<i.length;t++){(0,i[t])(e)}},e.prototype.map=function(t){var i=new e(t(this.value));return this.subscribe(function(e){i.next(t(e))}),this.catch(function(e){i.error(e)}),i},e.prototype.catch=function(e){return this.errorListeners.push(e),new Subscription(this.errorListeners,e)},e.prototype.error=function(e){for(var t=0,i=this.errorListeners;t<i.length;t++){(0,i[t])(e)}},e.prototype.subscribe=function(e,t){return this.listeners.push(e),t&&this.errorListeners.push(t),new Subscription(this.listeners,e)},e.prototype.toPromise=function(){var e=this;return new Promise(function(t,i){var n=e.subscribe(function(e){t(e),n.unsubscribe()},function(e){i(e),n.unsubscribe()})})},e.prototype.promise=function(){return this.toPromise()},e}(),State={Pending:"Pending",Fulfilled:"Fulfilled",Rejected:"Rejected"};function isFunction(e){return e&&"function"==typeof e}function isObject(e){return e&&"object"==typeof e}var TinyPromise=function(){function e(e){this._state=State.Pending,this._handlers=[],this._value=null,e(this._resolve.bind(this),this._reject.bind(this))}return e.prototype._resolve=function(t){var i=this;if(t instanceof e)t.then(this._resolve.bind(this),this._reject.bind(this));else if(isObject(t)||isFunction(t)){var n=!1;try{var r=t.then;isFunction(r)?r.call(t,function(e){n||i._resolve(e),n=!0},function(e){n||i._reject(e),n=!0}):this._fulfill(t)}catch(e){n||this._reject(e)}}else this._fulfill(t)},e.prototype._fulfill=function(e){var t=this;this._state=State.Fulfilled,this._value=e,this._handlers.forEach(function(e){return t._callHandler(e)})},e.prototype._reject=function(e){var t=this;this._state=State.Rejected,this._value=e,this._handlers.forEach(function(e){return t._callHandler(e)})},e.prototype._isPending=function(){return this._state===State.Pending},e.prototype._isFulfilled=function(){return this._state===State.Fulfilled},e.prototype._isRejected=function(){return this._state===State.Rejected},e.prototype._addHandler=function(e,t){this._handlers.push({onFulfilled:e,onRejected:t})},e.prototype._callHandler=function(e){this._isFulfilled()&&isFunction(e.onFulfilled)?e.onFulfilled(this._value):this._isRejected()&&isFunction(e.onRejected)&&e.onRejected(this._value)},e.prototype.then=function(t,i){var n=this;switch(this._state){case State.Pending:return new e(function(e,r){n._addHandler(function(i){nextTick(function(){try{isFunction(t)?e(t(i)):e(i)}catch(e){r(e)}})},function(t){nextTick(function(){try{isFunction(i)?e(i(t)):r(t)}catch(e){r(e)}})})});case State.Fulfilled:return new e(function(e,i){nextTick(function(){try{isFunction(t)?e(t(n._value)):e(n._value)}catch(e){i(e)}})});case State.Rejected:return new e(function(e,t){nextTick(function(){try{isFunction(i)?e(i(n._value)):t(n._value)}catch(e){t(e)}})})}},e}(),Promise$1="undefined"!=typeof Promise?Promise:TinyPromise,serverOnlyRequire;try{serverOnlyRequire=eval("require")}catch(e){serverOnlyRequire=function(){return null}}var serverOnlyRequire$1=serverOnlyRequire;function promiseResolve(e){return new Promise$1(function(t){return t(e)})}function tinyFetch(e,t){return void 0===t&&(t={}),new Promise$1(function(i,n){var r=new XMLHttpRequest;if(r.open(t.method||"get",e,!0),t.headers)for(var o in t.headers)r.setRequestHeader(o,t.headers[o]);function s(){var e=[],t=[],i={},n=void 0;return r.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(r,o,s){var a=o;return e.push(a=a.toLowerCase()),t.push([a,s]),n=i[a],i[a]=n?"".concat(n,",").concat(s):s,""}),{ok:2==(r.status/100|0),status:r.status,statusText:r.statusText,url:r.responseURL,clone:s,text:function(){return promiseResolve(r.responseText)},json:function(){return promiseResolve(r.responseText).then(JSON.parse)},blob:function(){return promiseResolve(new Blob([r.response]))},headers:{keys:function(){return e},entries:function(){return t},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}}r.withCredentials="include"===t.credentials,r.onload=function(){i(s())},r.onerror=n,r.send(t.body)})}var fetch="object"==typeof global&&"function"==typeof global.fetch?global.fetch:"undefined"==typeof window?serverOnlyRequire$1("node-fetch"):void 0!==window.fetch?window.fetch:tinyFetch;function assign(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var n=Object(e),r=1;r<arguments.length;r++){var o=arguments[r];if(null!=o)for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(n[s]=o[s])}return n}function throttle(e,t,i){var n,r,o;void 0===i&&(i={});var s=null,a=0,u=function(){a=!1===i.leading?0:Date.now(),s=null,o=e.apply(n,r),s||(n=r=null)};return function(){var c=Date.now();a||!1!==i.leading||(a=c);var d=t-(c-a);return n=this,r=arguments,d<=0||d>t?(s&&(clearTimeout(s),s=null),a=c,o=e.apply(n,r),s||(n=r=null)):s||!1===i.trailing||(s=setTimeout(u,d)),o}}var camelCaseToKebabCase=function(e){return e?e.replace(/([A-Z])/g,function(e){return"-".concat(e[0].toLowerCase())}):""},Animator=function(){function e(){}return e.prototype.bindAnimations=function(e){for(var t=0,i=e;t<i.length;t++){var n=i[t];switch(n.trigger){case"pageLoad":this.triggerAnimation(n);break;case"hover":this.bindHoverAnimation(n);break;case"scrollInView":this.bindScrollInViewAnimation(n)}}},e.prototype.warnElementNotPresent=function(e){console.warn("Cannot animate element: element with ID ".concat(e," not found!"))},e.prototype.augmentAnimation=function(e,t){for(var i=this.getAllStylesUsed(e),n=getComputedStyle(t),r=0,o=[e.steps[0].styles,e.steps[e.steps.length-1].styles];r<o.length;r++)for(var s=o[r],a=0,u=i;a<u.length;a++){var c=u[a];c in s||(s[c]=n[c])}},e.prototype.getAllStylesUsed=function(e){for(var t=[],i=0,n=e.steps;i<n.length;i++){var r=n[i];for(var o in r.styles)-1===t.indexOf(o)&&t.push(o)}return t},e.prototype.triggerAnimation=function(e){var t=this,i=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));i.length?Array.from(i).forEach(function(i){t.augmentAnimation(e,i),i.style.transition="none",i.style.transitionDelay="0",assign(i.style,e.steps[0].styles),setTimeout(function(){i.style.transition="all ".concat(e.duration,"s ").concat(camelCaseToKebabCase(e.easing)),e.delay&&(i.style.transitionDelay=e.delay+"s"),assign(i.style,e.steps[1].styles),setTimeout(function(){i.style.transition="",i.style.transitionDelay=""},1e3*(e.delay||0)+1e3*e.duration+100)})}):this.warnElementNotPresent(e.elementId||e.id||"")},e.prototype.bindHoverAnimation=function(e){var t=this,i=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));i.length?Array.from(i).forEach(function(i){t.augmentAnimation(e,i);var n=e.steps[0].styles,r=e.steps[1].styles;function o(){assign(i.style,n)}o(),i.addEventListener("mouseenter",function(){assign(i.style,r)}),i.addEventListener("mouseleave",o),setTimeout(function(){i.style.transition="all ".concat(e.duration,"s ").concat(camelCaseToKebabCase(e.easing)),e.delay&&(i.style.transitionDelay=e.delay+"s")})}):this.warnElementNotPresent(e.elementId||e.id||"")},e.prototype.bindScrollInViewAnimation=function(e){var t=this,i=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));i.length?Array.from(i).forEach(function(i){t.augmentAnimation(e,i);var n=!1;function r(){var t,r,s;!n&&(t=i.getBoundingClientRect(),r=window.innerHeight,s=0*r,t.bottom>s&&t.top<r-s)&&(n=!0,setTimeout(function(){assign(i.style,e.steps[1].styles),document.removeEventListener("scroll",o),setTimeout(function(){i.style.transition="",i.style.transitionDelay=""},1e3*(1e3*e.duration+(e.delay||0))+100)}))}var o=throttle(r,200,{leading:!1});var s=e.steps[0].styles;assign(i.style,s),setTimeout(function(){i.style.transition="all ".concat(e.duration,"s ").concat(camelCaseToKebabCase(e.easing)),e.delay&&(i.style.transitionDelay=e.delay+"s")}),document.addEventListener("scroll",o,{capture:!0,passive:!0}),r()}):this.warnElementNotPresent(e.elementId||e.id||"")},e}();function getTopLevelDomain(e){var t=e.split(".");return t.length>2?t.slice(1).join("."):e}var fieldContentRegExp=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Cookies=function(){function e(e,t){this.request=e,this.response=t}return e.prototype.get=function(e){var t=this.request.headers.cookie;if(t){var i=t.match(getPattern(e));if(i)return i[1]}},e.prototype.set=function(e,t,i){var n=this.response,r=this.request,o=n.getHeader("Set-Cookie")||[],s=void 0!==this.secure?!!this.secure:"https"===r.protocol||r.connection.encrypted,a=new Cookie(e,t,i);if("string"==typeof o&&(o=[o]),!s&&i&&i.secure)throw new Error("Cannot send secure cookie over unencrypted connection");return a.secure=s,i&&"secure"in i&&(a.secure=!!i.secure),a.domain=r.headers.host&&getTopLevelDomain(r.headers.host),pushCookie(o,a),n.setHeader.call(n,"Set-Cookie",o),this},e}(),Cookie=function(){function e(e,t,i){if(this.path="/",this.domain=void 0,this.httpOnly=!0,this.sameSite=!1,this.secure=!1,this.overwrite=!1,this.name="",this.value="",!fieldContentRegExp.test(e))throw new TypeError("argument name is invalid");if(t&&!fieldContentRegExp.test(t))throw new TypeError("argument value is invalid");t||(this.expires=new Date(0)),this.name=e,this.value=t||"",i.expires&&(this.expires=i.expires),i.secure&&(this.secure=i.secure)}return e.prototype.toString=function(){return"".concat(this.name,"=").concat(this.value)},e.prototype.toHeader=function(){var e=this.toString();return this.maxAge&&(this.expires=new Date(Date.now()+this.maxAge)),this.path&&(e+="; path=".concat(this.path)),this.expires&&(e+="; expires=".concat(this.expires.toUTCString())),this.domain&&(e+="; domain=".concat(this.domain)),e+="; SameSite=".concat(!0===this.sameSite?"strict":"None"),this.secure&&(e+="; secure"),this.httpOnly&&(e+="; httponly"),e},e}();function getPattern(e){return new RegExp("(?:^|;) *".concat(e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),"=([^;]*)"))}function pushCookie(e,t){if(t.overwrite)for(var i=e.length-1;i>=0;i--)0===e[i].indexOf("".concat(t.name,"="))&&e.splice(i,1);e.push(t.toHeader())}function omit(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];for(var n=Object.assign({},e),r=0,o=t;r<o.length;r++){delete n[o[r]]}return n}function uuidv4(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})}function uuid(){return uuidv4().replace(/-/g,"")}function pad(e,t){for(;e.length<t;)e="0"+e;return e}function fold(e,t){var i,n;if(0===t.length)return e;for(i=0,n=t.length;i<n;i++)e=(e<<5)-e+t.charCodeAt(i),e|=0;return e<0?-2*e:e}function foldObject(e,t,i){return Object.keys(t).sort().reduce(function(e,n){return foldValue(e,t[n],n,i)},e)}function foldValue(e,t,i,n){var r=fold(fold(fold(e,i),toString(t)),typeof t);if(null===t)return fold(r,"null");if(void 0===t)return fold(r,"undefined");if("object"==typeof t||"function"==typeof t){if(-1!==n.indexOf(t))return fold(r,"[Circular]"+i);n.push(t);var o=foldObject(r,t,n);if(!("valueOf"in t)||"function"!=typeof t.valueOf)return o;try{return fold(o,String(t.valueOf()))}catch(e){return fold(o,"[valueOf exception]"+(e.stack||e.message))}}return fold(r,t.toString())}function toString(e){return Object.prototype.toString.call(e)}function sum(e){return pad(foldValue(0,e,"",[]).toString(16),8)}var hashSum=sum;function datePlusMinutes(e){return void 0===e&&(e=30),new Date(Date.now()+6e4*e)}var isPositiveNumber=function(e){return"number"==typeof e&&!isNaN(e)&&e>=0},isReactNative="object"==typeof navigator&&"ReactNative"===navigator.product,validEnvList=["production","qa","test","development","dev","cdn-qa","cloud","fast","cdn2","cdn-prod"];function getQueryParam(e,t){for(var i=(e.split("?")[1]||"").split("&"),n=0;n<i.length;n++){var r=i[n].split("=");if(decodeURIComponent(r[0])===t)return decodeURIComponent(r[1])}return null}var urlParser={parse:function(e){var t=document.createElement("a");t.href=e;for(var i={},n="username password host hostname port protocol origin pathname search hash".split(" "),r=n.length;r--;)i[n[r]]=t[n[r]];return!i.pathname&&""!==i.pathname||"string"!=typeof i.pathname||0===i.pathname.indexOf("/")||(i.pathname="/"+i.pathname),i}},parse=isReactNative?function(){return{}}:"object"==typeof window?urlParser.parse:serverOnlyRequire$1("url").parse;function setCookie(e,t,i){try{var n="";i&&(n="; expires="+i.toUTCString());var r=!isBrowser||"https:"===location.protocol;document.cookie=e+"="+(t||"")+n+"; path=/"+"; domain=".concat(getTopLevelDomain(location.hostname))+(r?";secure ; SameSite=None":"")}catch(e){console.warn("Could not set cookie",e)}}function getCookie(e){try{return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null}catch(e){console.warn("Could not get cookie",e)}}function size(e){return Object.keys(e).length}function find(e,t){for(var i=e,n=i.length>>>0,r=arguments[1],o=0;o<n;o++){var s=i[o];if(t.call(r,s,o,i))return s}}var sessionStorageKey="builderSessionId",localStorageKey="builderVisitorId",isBrowser="undefined"!=typeof window&&!isReactNative,isIframe=isBrowser&&window.top!==window.self;function BuilderComponent(e){return void 0===e&&(e={}),Builder.Component(e)}var Builder=function(){function e(t,i,n,r,o){void 0===t&&(t=null),void 0===r&&(r=!1),void 0===o&&(o=null);var s=this;if(this.request=i,this.response=n,this.eventsQueue=[],this.throttledClearEventsQueue=throttle(function(){s.processEventsQueue(),s.setCookie(sessionStorageKey,s.sessionId,datePlusMinutes(30))},5),this.env="production",this.sessionId=this.getSessionId(),this.targetContent=!0,this.contentPerRequest=1,this.allowCustomFonts=!0,this.cookies=null,this.cachebust=!1,this.overrideParams="",this.noCache=!1,this.preview=!1,this.canTrack$=new BehaviorSubject(!this.browserTrackingDisabled),this.apiKey$=new BehaviorSubject(null),this.authToken$=new BehaviorSubject(null),this.userAttributesChanged=new BehaviorSubject(null),this.editingMode$=new BehaviorSubject(isIframe),this.editingModel$=new BehaviorSubject(null),this.userAgent="object"==typeof navigator&&navigator.userAgent||"",this.trackingHooks=[],this.visitorId=this.getVisitorId(),this.autoTrack=!!e.isBrowser&&!(this.isDevelopmentEnv||e.isBrowser&&-1!==location.search.indexOf("builder.preview=")),this.trackingUserAttributes={},this.blockContentLoading="",this.observersByKey={},this.noEditorUpdates={},this.overrides={},this.getContentQueue=null,this.priorContentQueue=null,this.testCookiePrefix="builder.tests",this.cookieQueue=[],e.isBrowser&&!r&&e.singletonInstance)return e.singletonInstance;this.request&&this.response&&(this.setUserAgent(this.request.headers["user-agent"]||""),this.cookies=new Cookies(this.request,this.response)),t&&(this.apiKey=t),o&&(this.authToken=o),isBrowser&&this.bindMessageListeners(),isIframe&&this.messageFrameLoaded(),this.canTrack$.subscribe(function(e){if(e){if("undefined"!=typeof sessionStorage)try{sessionStorage.getItem(sessionStorageKey)||sessionStorage.setItem(sessionStorageKey,s.sessionId)}catch(e){console.debug("Session storage error",e)}s.eventsQueue.length&&s.throttledClearEventsQueue(),s.cookieQueue.length&&(s.cookieQueue.forEach(function(e){s.setCookie(e[0],e[1])}),s.cookieQueue.length=0)}}),isBrowser&&(this.setTestsFromUrl(),this.getOverridesFromQueryString())}return e.register=function(t,i){var n=this.registry[t];if(n||(n=this.registry[t]=[]),n.push(i),e.isBrowser){var r={type:"builder.register",data:{type:t,info:i}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(e){console.debug("Could not postmessage",e)}}this.registryChange.next(this.registry)},e.registerEditor=function(t){if(e.isBrowser){window.postMessage({type:"builder.registerEditor",data:omit(t,"component")},"*");var i=location.hostname;e.isTrustedHost(i)||console.error("Builder.registerEditor() called in the wrong environment! You cannot load custom editors from your app, they must be loaded through the Builder.io app itself. Follow the readme here for more details: https://github.com/builderio/builder/tree/master/plugins/cloudinary or contact chat us in our Spectrum community for help: https://spectrum.chat/builder")}this.editors.push(t)},e.registerPlugin=function(e){this.plugins.push(e)},e.registerAction=function(e){this.actions.push(e)},e.registerTrustedHost=function(e){this.trustedHosts.push(e)},e.isTrustedHost=function(e){return this.trustedHosts.findIndex(function(t){return t===e||e.endsWith(".".concat(t))})>-1},e.runAction=function(e){if(!("string"==typeof e?find(this.actions,function(t){return t.name===e}):e))throw new Error("Action not found: ".concat(e))},e.fields=function(e,t){var i;null===(i=window.parent)||void 0===i||i.postMessage({type:"builder.fields",data:{name:e,fields:t}},"*")},e.set=function(t){e.register("editor.settings",t)},e.import=function(t){if(e.isBrowser){var i=window.System;if(i)return i.import("https://cdn.builder.io/systemjs/".concat(t));console.warn("System.js not available. Please include System.js when using Builder.import")}else console.warn("Builder.import used on the server - this should only be used in the browser")},Object.defineProperty(e,"editingPage",{get:function(){return this._editingPage},set:function(e){this._editingPage=e,isBrowser&&isIframe&&(e?document.body.classList.add("builder-editing-page"):document.body.classList.remove("builder-editing-page"))},enumerable:!1,configurable:!0}),e.prepareComponentSpecToSend=function(e){return __assign(__assign(__assign({},e),e.inputs&&{inputs:e.inputs.map(function(e){for(var t,i=0,n=["onChange","showIf"];i<n.length;i++){var r=n[i];if(e[r]&&"function"==typeof e[r]){var o=e[r];e=__assign(__assign({},e),((t={})[r]="return (".concat(o.toString(),").apply(this, arguments)"),t))}}return e})}),{hooks:Object.keys(e.hooks||{}).reduce(function(t,i){var n=e.hooks&&e.hooks[i];return n?(t[i]="string"==typeof n?n:"return (".concat(n.toString(),").apply(this, arguments)"),t):t},{}),class:void 0})},e.registerBlock=function(e,t){this.registerComponent(e,t)},e.registerComponent=function(e,t){var i,n=__assign(__assign({class:e},e.builderOptions),t);if(this.addComponent(n),t.models&&this.singletonInstance.editingModel?isBrowser&&t.models.includes(this.singletonInstance.editingModel):isBrowser){var r=this.prepareComponentSpecToSend(n);null===(i=window.parent)||void 0===i||i.postMessage({type:"builder.registerComponent",data:r},"*")}},e.addComponent=function(e){var t=find(this.components,function(t){return t.name===e.name});if(t){if(t.class&&!e.class)return;this.components.splice(this.components.indexOf(t),1,e)}else this.components.push(e)},e.component=function(e){var t=this;return void 0===e&&(e={}),function(i){var n,r=__assign(__assign({},e),{class:i});r.name||(r.name=i.name),t.addComponent(r);var o=t.prepareComponentSpecToSend(r);return isBrowser&&(null===(n=window.parent)||void 0===n||n.postMessage({type:"builder.registerComponent",data:o},"*")),i}},Object.defineProperty(e,"Component",{get:function(){return this.component},enumerable:!1,configurable:!0}),e.prototype.processEventsQueue=function(){if(this.eventsQueue.length){var t=this.eventsQueue;this.eventsQueue=[];for(var i=__assign(__assign({},e.overrideUserAttributes),this.trackingUserAttributes),n=0,r=t;n<r.length;n++){var o=r[n];o.data.metadata||(o.data.metadata={}),o.data.metadata.user||(o.data.metadata.user={}),Object.assign(o.data.metadata.user,i,o.data.metadata.user)}var s=this.host;fetch("".concat(s,"/api/v1/track"),{method:"POST",body:JSON.stringify({events:t}),headers:{"content-type":"application/json"},mode:"cors"}).catch(function(){})}},Object.defineProperty(e.prototype,"browserTrackingDisabled",{get:function(){return Boolean(e.isBrowser&&window.builderNoTrack||!navigator.cookieEnabled)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canTrack",{get:function(){return this.canTrack$.value},set:function(e){this.canTrack!==e&&this.canTrack$.next(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"editingMode",{get:function(){return this.editingMode$.value},set:function(e){e!==this.editingMode&&this.editingMode$.next(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"editingModel",{get:function(){return this.editingModel$.value},set:function(e){e!==this.editingModel&&this.editingModel$.next(e)},enumerable:!1,configurable:!0}),e.prototype.findParentElement=function(e,t,i){if(void 0===i&&(i=!0),!(e instanceof HTMLElement))return null;var n=i?e:e.parentElement;do{if(!n)return null;if(t(n))return n}while(n=n.parentElement);return null},e.prototype.findBuilderParent=function(e){return this.findParentElement(e,function(e){var t=e.getAttribute("builder-id")||e.id;return Boolean(t&&0===t.indexOf("builder-"))})},e.prototype.setUserAgent=function(e){this.userAgent=e||""},e.prototype.setTrackingHook=function(e){this.trackingHooks.push(e)},e.prototype.track=function(t,i,n){if(void 0===i&&(i={}),!isIframe&&isBrowser&&!e.isPreviewing){var r=this.apiKey;if(r){for(var o=JSON.parse(JSON.stringify({type:t,data:__assign(__assign({},omit(i,"meta")),{metadata:__assign(__assign({sdkVersion:e.VERSION,url:location.href},i.meta),i.metadata),ownerId:r,userAttributes:this.getUserAttributes(),sessionId:this.sessionId,visitorId:this.visitorId})})),s=0,a=this.trackingHooks;s<a.length;s++){var u=(0,a[s])(o,n||{});u&&(o=u)}this.eventsQueue.push(o),this.canTrack&&this.throttledClearEventsQueue()}else console.error('Builder integration error: Looks like the Builder SDK has not been initialized properly (your API key has not been set). Make sure you are calling `builder.init("«YOUR-API-KEY»");` as early as possible in your application\'s code.')}},e.prototype.getSessionId=function(){var t=this,i=null;try{e.isBrowser&&"undefined"!=typeof sessionStorage&&(i=this.getCookie(sessionStorageKey))}catch(e){console.debug("Session storage error",e)}return i||(i=uuid()),e.isBrowser&&setTimeout(function(){try{t.canTrack&&t.setCookie(sessionStorageKey,i,datePlusMinutes(30))}catch(e){console.debug("Cookie setting error",e)}}),i},e.prototype.getVisitorId=function(){var t=this;if(this.visitorId)return this.visitorId;var i=null;try{e.isBrowser&&"undefined"!=typeof localStorage&&(i=localStorage.getItem(localStorageKey))}catch(e){console.debug("Local storage error",e)}return i||(i=uuid()),this.visitorId=i,e.isBrowser&&setTimeout(function(){try{t.canTrack&&"undefined"!=typeof localStorage&&i&&localStorage.setItem(localStorageKey,i)}catch(e){console.debug("Session storage error",e)}}),i},e.prototype.trackImpression=function(t,i,n,r){isIframe||!isBrowser||e.isPreviewing||this.track("impression",{contentId:t,variationId:i!==t?i:void 0,metadata:n},r)},e.prototype.trackConversion=function(t,i,n,r,o){if(!isIframe&&isBrowser&&!e.isPreviewing){var s="object"==typeof i?i:r,a="string"==typeof i?i:void 0;this.track("conversion",{amount:t,variationId:n,meta:s,contentId:a},o)}},Object.defineProperty(e.prototype,"isDevelopmentEnv",{get:function(){return e.isIframe||e.isBrowser&&("localhost"===location.hostname||""!==location.port)||"production"!==this.env},enumerable:!1,configurable:!0}),e.prototype.trackInteraction=function(t,i,n,r,o){if(void 0===n&&(n=!1),!isIframe&&isBrowser&&!e.isPreviewing){var s=r&&r.target,a=s&&this.findBuilderParent(s),u={};if(r){var c=r.clientX,d=r.clientY;if(s){var l=c-(g=s.getBoundingClientRect()).left,h=d-g.top,p=y(l/g.width),f=y(h/g.height);u.targetOffset={x:p,y:f}}if(a){var g;l=c-(g=a.getBoundingClientRect()).left,h=d-g.top,p=y(l/g.width),f=y(h/g.height);u.builderTargetOffset={x:p,y:f}}}var v=a&&(a.getAttribute("builder-id")||a.id);v&&a&&(u.builderElementIndex=[].slice.call(document.getElementsByClassName(v)).indexOf(a)),this.track("click",{contentId:t,metadata:u,variationId:i!==t?i:void 0,unique:!n,targetBuilderElement:v||void 0},o)}function y(e){return Math.round(1e3*e)/1e3}},e.prototype.component=function(t){return void 0===t&&(t={}),e.component(t)},Object.defineProperty(e.prototype,"apiKey",{get:function(){return this.apiKey$.value},set:function(e){this.apiKey$.next(e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"authToken",{get:function(){return this.authToken$.value},set:function(e){this.authToken$.next(e)},enumerable:!1,configurable:!0}),e.prototype.modifySearch=function(e){return e.replace(/(^|&|\?)(builder_.*?)=/gi,function(e,t,i){return t+i.replace(/_/g,".")+"="})},e.prototype.setTestsFromUrl=function(){var e=this.getLocation().search,t=QueryString.parseDeep(this.modifySearch(e||"").substr(1)),i=t.builder&&t.builder.tests;if(i&&"object"==typeof i)for(var n in i)i.hasOwnProperty(n)&&this.setTestCookie(n,i[n])},e.prototype.resetOverrides=function(){e.overrideUserAttributes={},this.cachebust=!1,this.noCache=!1,this.preview=!1,this.editingModel=null,this.overrides={},this.env="production",this.userAgent="",this.request=void 0,this.response=void 0},e.prototype.getOverridesFromQueryString=function(){var t=this.getLocation(),i=QueryString.parseDeep(this.modifySearch(t.search||"").substr(1)),n=i.builder;if(n){var r=n.userAttributes,o=n.overrides,s=n.env,a=(n.host,n.api),u=n.cachebust,c=n.noCache,d=n.preview,l=n.editing,h=n.frameEditing,p=n.params;if(r&&this.setUserAttributes(r),o&&(this.overrides=o),validEnvList.indexOf(s||a)>-1&&(this.env=s||a),e.isEditing){var f=h||l||d;f&&"true"!==f&&(this.editingModel=f)}u&&(this.cachebust=!0),c&&(this.noCache=!0),d&&(this.preview=!0),i&&(this.overrideParams=p)}},e.prototype.messageFrameLoaded=function(){var e;null===(e=window.parent)||void 0===e||e.postMessage({type:"builder.loaded",data:{value:!0}},"*")},e.prototype.bindMessageListeners=function(){var t=this;isBrowser&&addEventListener("message",function(i){var n,r,o,s,a,u=parse(i.origin),c=-1===["builder.register","builder.registerComponent"].indexOf(null===(n=i.data)||void 0===n?void 0:n.type),d=u.hostname&&e.isTrustedHost(u.hostname);if(!c||d){var l=i.data;if(l)switch(l.type){case"builder.ping":null===(r=window.parent)||void 0===r||r.postMessage({type:"builder.pong",data:{}},"*");break;case"builder.register":if(i.source===window)break;var h=l.data;if(!h)break;var p=h.type,f=h.info,g=e.registry[p];g||(g=e.registry[p]=[]),g.push(f),e.registryChange.next(e.registry);break;case"builder.settingsChange":if(i.source===window)break;var v=l.data;if(!v)break;Object.assign(e.settings,v),e.settingsChange.next(e.settings);break;case"builder.registerEditor":if(i.source===window)break;var y=l.data;if(!y)break;var m=!!y.component;e.editors.every(function(t,i){return y.name!==t.name||!(t.component&&!m)&&(e.editors[i]=t,!1)});break;case"builder.triggerAnimation":e.animator.triggerAnimation(l.data);break;case"builder.contentUpdate":var b=l.data.key||l.data.alias||l.data.entry||l.data.modelName,w=l.data.data,k=t.observersByKey[b];k&&!t.noEditorUpdates[b]&&k.next([w]);break;case"builder.getComponents":null===(o=window.parent)||void 0===o||o.postMessage({type:"builder.components",data:e.components.map(function(t){return e.prepareComponentSpecToSend(t)})},"*");break;case"builder.editingModel":t.editingModel=l.data.model;break;case"builder.registerComponent":var C=l.data;e.addComponent(C);break;case"builder.blockContentLoading":"string"==typeof l.data.model&&(t.blockContentLoading=l.data.model);break;case"builder.editingMode":l.data?(t.editingMode=!0,document.body.classList.add("builder-editing")):(t.editingMode=!1,document.body.classList.remove("builder-editing"));break;case"builder.editingPageMode":var S=l.data;e.editingPage=S;break;case"builder.overrideUserAttributes":var _=l.data;assign(e.overrideUserAttributes,_),t.flushGetContentQueue(!0);break;case"builder.overrideTestGroup":var x=l.data,T=x.variationId,B=x.contentId;T&&B&&(t.setTestCookie(B,T),t.flushGetContentQueue(!0));break;case"builder.evaluate":var O=l.data.text,P=l.data.arguments||[],I=l.data.id,E=new Function(O),A=void 0,j=null;try{A=E.apply(t,P)}catch(e){j=e}j?null===(s=window.parent)||void 0===s||s.postMessage({type:"builder.evaluateError",data:{id:I,error:j.message}},"*"):A&&"function"==typeof A.then?A.then(function(e){var t;null===(t=window.parent)||void 0===t||t.postMessage({type:"builder.evaluateResult",data:{id:I,result:e}},"*")}).catch(console.error):null===(a=window.parent)||void 0===a||a.postMessage({type:"builder.evaluateResult",data:{result:A,id:I}},"*")}}})},Object.defineProperty(e.prototype,"defaultCanTrack",{get:function(){return Boolean(e.isBrowser&&navigator.userAgent.trim()&&!navigator.userAgent.match(/bot|crawler|spider|robot|crawling|prerender|google|baidu|bing|msn|duckduckbot|teoma|slurp|yandex|phantom|headless|selenium|puppeteer/i)&&!this.browserTrackingDisabled)},enumerable:!1,configurable:!0}),e.prototype.init=function(e,t,i,n,r){return void 0===t&&(t=this.defaultCanTrack),i&&(this.request=i),n&&(this.response=n),this.canTrack=t,this.apiKey=e,r&&(this.authToken=r),this},Object.defineProperty(e.prototype,"previewingModel",{get:function(){var e=this.getLocation().search;return QueryString.parse((e||"").substr(1))["builder.preview"]},enumerable:!1,configurable:!0}),e.prototype.getLocation=function(){var e={};return this.request?e=parse(this.request.url):"object"==typeof location&&(e=parse(location.href)),""===e.pathname&&(e.pathname="/"),e},e.prototype.getUserAttributes=function(t){void 0===t&&(t=this.userAgent||"");var i={Android:function(){return t.match(/Android/i)},BlackBerry:function(){return t.match(/BlackBerry/i)},iOS:function(){return t.match(/iPhone|iPod/i)},Opera:function(){return t.match(/Opera Mini/i)},Windows:function(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any:function(){return i.Android()||i.BlackBerry()||i.iOS()||i.Opera()||i.Windows()}},n=t.match(/Tablet|iPad/i),r=this.getLocation();return __assign({urlPath:r.pathname,host:r.host||r.hostname,device:n?"tablet":i.any()?"mobile":"desktop"},e.overrideUserAttributes)},e.prototype.setUserAttributes=function(t){assign(e.overrideUserAttributes,t),this.userAttributesChanged.next(t)},e.prototype.setTrackingUserAttributes=function(e){assign(this.trackingUserAttributes,e)},e.prototype.get=function(t,i){void 0===i&&(i={});var n=this;return e.isBrowser?(i.apiKey&&!this.apiKey&&(this.apiKey=i.apiKey),i.authToken&&!this.authToken&&(this.authToken=i.authToken)):(n=new e(i.apiKey||this.apiKey,i.req,i.res,void 0,i.authToken||this.authToken)).setUserAttributes(this.getUserAttributes()),n.queueGetContent(t,i).map(function(t){var i=t&&t[0];if(e.isStatic)return i;var n=i&&i.data;return n?(void 0!==n.blocksString&&(n.blocks=JSON.parse(n.blocksString),delete n.blocksString),{data:n,id:i.id,variationId:i.testVariationId||i.variationId||null,testVariationId:i.testVariationId||i.variationId||null,testVariationName:i.testVariationName||null,lastUpdated:i.lastUpdated||null}):null})},e.prototype.queueGetContent=function(t,i){var n=this;void 0===i&&(i={});var r=i.key||i.alias||t,o=this.editingModel===t,s=this.observersByKey[r];"DEMO"!==this.apiKey||this.overrides[r]||i.initialContent||(i.initialContent=[]);var a=i.initialContent;if(s&&(!s.value||i.cache))return s.value&&nextTick(function(){s.next(s.value)}),s;if(o&&e.isBrowser&&parent.postMessage({type:"builder.updateContent",data:{options:i}},"*"),!a)if(this.getContentQueue||(this.getContentQueue=[]),this.getContentQueue.push(__assign(__assign({},i),{model:t,key:r})),this.getContentQueue&&this.getContentQueue.length>=this.contentPerRequest){var u=this.getContentQueue.slice();this.getContentQueue=[],nextTick(function(){n.flushGetContentQueue(!1,u)})}else nextTick(function(){n.flushGetContentQueue()});var c=new BehaviorSubject(null);return this.observersByKey[r]=c,i.noEditorUpdates&&(this.noEditorUpdates[r]=!0),a&&nextTick(function(){c.next(a)}),c},e.prototype.requestUrl=function(t,i){return e.isBrowser?fetch(t,i).then(function(e){return e.json()}):new Promise(function(e,n){var r=parse(t),o="http:"===r.protocol?serverOnlyRequire$1("http"):serverOnlyRequire$1("https"),s={host:r.hostname,port:r.port,path:r.pathname+r.search,headers:__assign({},null===i||void 0===i?void 0:i.headers)};o.get(s,function(t){var i="";t.setEncoding("utf8"),t.on("data",function(e){i+=e}),t.on("end",function(){try{e(JSON.parse(i))}catch(e){if("SyntaxError"===(null===e||void 0===e?void 0:e.name)){var t=new Error("[Builder.io] ERROR: invalid response.\nRequest: ".concat(JSON.stringify(s,null,2),"\nResponse Data: ").concat(i,"\n"));n(t)}n(e)}})}).on("error",function(e){n(e)})})},Object.defineProperty(e.prototype,"host",{get:function(){switch(this.env){case"qa":return"https://qa.builder.io";case"test":return"https://builder-io-test.web.app";case"fast":return"https://fast.builder.io";case"cloud":return"https://cloud.builder.io";case"cdn2":return"https://cdn2.builder.io";case"cdn-qa":return"https://cdn-qa.builder.io";case"development":case"dev":return"http://localhost:5000";case"cdn-prod":return"https://cdn.builder.io";default:return e.overrideHost||"https://cdn.builder.io"}},enumerable:!1,configurable:!0}),e.prototype.flushGetContentQueue=function(t,i){var n=this;if(void 0===t&&(t=!1),!this.apiKey)throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));if(t||this.getContentQueue){var r=i||(t?this.priorContentQueue:this.getContentQueue)||[];this.getOverridesFromQueryString();var o=__assign({omit:r[0].omit||"meta.componentsUsed",apiKey:this.apiKey},r[0].options);r[0].fields&&(o.fields=r[0].fields),r[0].format&&(o.format=r[0].format);var s="undefined"!=typeof location?QueryString.parseDeep(location.search.substr(1)):{},a=r&&r[0].userAttributes?r[0].userAttributes:this.targetContent?this.getUserAttributes():{urlPath:this.getLocation().pathname};if(r.find(function(e){return!!e.includeUrl})){var u=this.getLocation();u.origin&&(o.url="".concat(u.origin).concat(u.pathname).concat(u.search))}var c=null===i||void 0===i?void 0:i.find(function(e){return e.url});if((null===c||void 0===c?void 0:c.url)&&(a.urlPath=c.url.split("?")[0]),o.userAttributes=a,t||i||(this.priorContentQueue=r,this.getContentQueue=null),(this.cachebust||isIframe||s.cachebust||s["builder.cachebust"]||"production"!==this.env)&&(o.cachebust=!0),e.isEditing&&(o.isEditing=!0),(this.noCache||"production"!==this.env)&&(o.noCache=!0),size(this.overrides))for(var d in this.overrides)this.overrides.hasOwnProperty(d)&&(o["overrides.".concat(d)]=this.overrides[d]);e.isReact||(o.prerender=!0);for(var l=0,h=r;l<h.length;l++){var p=h[l];p.format&&(o.format=p.format),p.static&&(o.static=p.static),p.cachebust&&(o.cachebust=p.cachebust),isPositiveNumber(p.cacheSeconds)&&(o.cacheSeconds=p.cacheSeconds),isPositiveNumber(p.staleCacheSeconds)&&(o.staleCacheSeconds=p.staleCacheSeconds);for(var f=0,g=["prerender","extractCss","limit","offset","query","preview","model","entry","rev","static"];f<g.length;f++){var v=p[d=g[f]];void 0!==v&&(o.options=o.options||{},o.options[p.key]=o.options[p.key]||{},o.options[p.key][d]=JSON.stringify(v))}}this.preview&&(o.preview="true");var y=Object.keys(o).length>0,m=this.host,b=r.map(function(e){return encodeURIComponent(e.key)}).join(",");if(this.overrideParams)assign(o,omit(QueryString.parse(this.overrideParams),"apiKey"));var w=QueryString.stringifyDeep(o),k=o.format,C={headers:{}};return this.authToken&&(C.headers=__assign(__assign({},C.headers),{Authorization:"Bearer ".concat(this.authToken)})),this.requestUrl("".concat(m,"/api/v1/").concat("solid"===k||"react"===k?"codegen":"query","/").concat(this.apiKey,"/").concat(b)+(o&&y?"?".concat(w):""),C).then(function(t){for(var i=0,o=r;i<o.length;i++){var s=o[i],a=s.key;if(s.model!==n.blockContentLoading||s.noEditorUpdates){n.editingModel===s.model&&e.isEditing&&parent.postMessage({type:"builder.updateContent",data:{options:s}},"*");var u=n.observersByKey[a];if(!u)return;var c=t[a],d=c;if(c){var l=e.isServer?d:n.processResultsForTests(d);u.next(l)}else{if((n.getLocation().search||"").includes("builder.preview="+s.model)){u.next([{id:"preview",name:"Preview",data:{}}])}u.next([])}}}},function(e){for(var t=0,i=r;t<i.length;t++){var o=i[t],s=n.observersByKey[o.key];if(!s)return;s.error(e)}})}},e.prototype.processResultsForTests=function(e){var t,i=this,n=e.map(function(e){if(!e.variations)return e;var t=i.getTestCookie(e.id),n=t===e.id?e:e.variations[t];if(n)return __assign(__assign({},e),{data:n.data,variationId:t,testVariationId:t,testVariationName:n.name});if(i.canTrack&&e.variations&&size(e.variations)){var r=0,o=Math.random();for(var s in e.variations){var a=e.variations[s];if(o<(r+=a.testRatio)){i.setTestCookie(e.id,a.id);var u=a.name||(a.id===e.id?"Default variation":"");return __assign(__assign({},e),{data:a.data,variationId:a.id,testVariationId:a.id,variationName:u,testVariationName:u})}}i.setTestCookie(e.id,e.id)}return __assign(__assign(__assign({},e),{variationId:e.id}),e.variations&&size(e.variations)&&{testVariationId:e.id,testVariationName:"Default variation"})});return isIframe&&(null===(t=window.parent)||void 0===t||t.postMessage({type:"builder.contentResults",data:{results:n}},"*")),n},e.prototype.getTestCookie=function(e){return this.getCookie("".concat(this.testCookiePrefix,".").concat(e))},e.prototype.setTestCookie=function(e,t){if(this.canTrack){var i=new Date;return i.setDate(i.getDate()+30),this.setCookie("".concat(this.testCookiePrefix,".").concat(e),t,i)}this.cookieQueue.push([e,t])},e.prototype.getCookie=function(t){return this.cookies?this.cookies.get(t):e.isBrowser&&getCookie(t)},e.prototype.setCookie=function(t,i,n){return!this.cookies||e.isServer&&e.isStatic?e.isBrowser&&setCookie(t,i,n):this.cookies.set(t,i,{expires:n,secure:"https:"===this.getLocation().protocol})},e.prototype.getContent=function(e,t){if(void 0===t&&(t={}),!this.apiKey)throw new Error("Fetching content from model ".concat(e," failed, expected apiKey to be defined instead got: ").concat(this.apiKey));return this.queueGetContent(e,t)},e.prototype.getAll=function(t,i){void 0===i&&(i={});var n=this;return e.isBrowser?i.apiKey&&!this.apiKey&&(this.apiKey=i.apiKey):(n=new e(i.apiKey||this.apiKey,i.req,i.res)).setUserAttributes(this.getUserAttributes()),n.getContent(t,__assign(__assign({limit:30},i),{key:i.key||e.isBrowser?"".concat(t,":").concat(hashSum(omit(i,"initialContent","req","res"))):void 0})).promise()},e.VERSION=version,e.components=[],e.isStatic=!0,e.animator=new Animator,e.nextTick=nextTick,e.throttle=throttle,e.editors=[],e.trustedHosts=["builder.io","localhost"],e.plugins=[],e.actions=[],e.registry={},e.registryChange=new BehaviorSubject({}),e._editingPage=!1,e.isIframe=isIframe,e.isBrowser=isBrowser,e.isReactNative=isReactNative,e.isServer=!isBrowser&&!isReactNative,e.previewingModel=e.isBrowser&&getQueryParam(location.href,"builder.preview"),e.settings={},e.settingsChange=new BehaviorSubject({}),e.isEditing=Boolean(isIframe&&(document.referrer&&document.referrer.match(/builder\.io|localhost:1234/)||-1!==location.search.indexOf("builder.frameEditing="))),e.isPreviewing=Boolean(isBrowser&&(-1!==location.search.indexOf("builder.preview=")||-1!==location.search.indexOf("builder.frameEditing="))),e.isReact=!1,e.overrideUserAttributes={},e}(),builder=new Builder(null,void 0,void 0,!0);Builder.singletonInstance=builder,exports.Builder=Builder,exports.BuilderComponent=BuilderComponent,exports.isBrowser=isBrowser,exports.BehaviorSubject=BehaviorSubject,exports.Subscription=Subscription,exports.builder=builder,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.browser.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.builder = exports.Subscription = exports.BehaviorSubject = exports.isBrowser = exports.BuilderComponent = exports.Builder = void 0; | ||
var builder_class_1 = require("./src/builder.class"); | ||
exports.Builder = builder_class_1.Builder; | ||
exports.BuilderComponent = builder_class_1.BuilderComponent; | ||
exports.isBrowser = builder_class_1.isBrowser; | ||
Object.defineProperty(exports, "Builder", { enumerable: true, get: function () { return builder_class_1.Builder; } }); | ||
Object.defineProperty(exports, "BuilderComponent", { enumerable: true, get: function () { return builder_class_1.BuilderComponent; } }); | ||
Object.defineProperty(exports, "isBrowser", { enumerable: true, get: function () { return builder_class_1.isBrowser; } }); | ||
var observable_class_1 = require("./src/classes/observable.class"); | ||
exports.BehaviorSubject = observable_class_1.BehaviorSubject; | ||
exports.Subscription = observable_class_1.Subscription; | ||
Object.defineProperty(exports, "BehaviorSubject", { enumerable: true, get: function () { return observable_class_1.BehaviorSubject; } }); | ||
Object.defineProperty(exports, "Subscription", { enumerable: true, get: function () { return observable_class_1.Subscription; } }); | ||
var builder_1 = require("./src/constants/builder"); | ||
exports.builder = builder_1.builder; | ||
Object.defineProperty(exports, "builder", { enumerable: true, get: function () { return builder_1.builder; } }); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@builder.io/sdk", | ||
"version": "1.1.26", | ||
"version": "1.1.27-0", | ||
"unpkg": "./dist/index.browser.js", | ||
@@ -16,2 +16,5 @@ "main": "./dist/index.cjs.js", | ||
"_install": "npm install", | ||
"docs": "npm run docs:generate && npm run docs:cleanup", | ||
"docs:generate": "typedoc", | ||
"docs:cleanup": "node scripts/cleanup-generated-docs", | ||
"build": "npm run tsc && rollup -c", | ||
@@ -45,2 +48,4 @@ "watch": "rollup -cw", | ||
"esbuild-runner": "2.2.1", | ||
"glob": "^7.2.3", | ||
"glob-promise": "^4.2.2", | ||
"jest": "27.4.7", | ||
@@ -58,3 +63,5 @@ "rollup": "^0.58.2", | ||
"rollup-plugin-uglify": "^3.0.0", | ||
"typescript": "^3.8.3" | ||
"typedoc": "^0.22.15", | ||
"typedoc-plugin-markdown": "^3.12.1", | ||
"typescript": "^4.6.4" | ||
}, | ||
@@ -61,0 +68,0 @@ "dependencies": { |
@@ -51,26 +51,71 @@ /// <reference types="@types/node" /> | ||
urlPath?: string; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
queryString?: string | ParamsMap; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
device?: 'mobile' | 'tablet' | 'desktop'; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
location?: any; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
userAgent?: string; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
referrer?: string; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
entryMedium?: string; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
language?: string; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
browser?: string; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
cookie?: string; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
newVisitor?: boolean; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
operatingSystem?: string; | ||
} | ||
export interface GetContentOptions { | ||
/** | ||
* User attribute key value pairs to be used for targeting | ||
* https://www.builder.io/c/docs/custom-targeting-attributes | ||
* | ||
* e.g. | ||
* ```js | ||
* userAttributes: { | ||
* urlPath: '/', | ||
* returnVisitor: true, | ||
* } | ||
* ``` | ||
*/ | ||
userAttributes?: UserAttributes; | ||
@@ -118,7 +163,10 @@ /** | ||
* | ||
* ```js | ||
* query: { | ||
* id: 'abc123', | ||
* data: { | ||
* myCustomField: { $gt: 20 }, | ||
* } | ||
* } | ||
* ``` | ||
* &query.data.id=abc123 | ||
* &query.data.myCustomField=someValue | ||
* &query.data.someNumber.$ne=20 | ||
* ``` | ||
* | ||
@@ -177,2 +225,3 @@ * See more info on MongoDB's query operators and format. | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
@@ -197,3 +246,6 @@ alias?: string; | ||
format?: 'amp' | 'email' | 'html' | 'react' | 'solid'; | ||
/** @deprecated */ | ||
/** | ||
* @deprecated | ||
* @hidden | ||
*/ | ||
noWrap?: true; | ||
@@ -250,18 +302,56 @@ /** | ||
} | ||
/** | ||
* This is the interface for inputs in `Builder.registerComponent` | ||
* | ||
* ```js | ||
* Builder.registerComponent(MyComponent, { | ||
* inputs: [{ name: 'title', type: 'text' }] // <- Input[] | ||
* }) | ||
* ``` | ||
* | ||
* Learn more about registering custom components [here](https://www.builder.io/c/docs/custom-react-components) | ||
*/ | ||
export interface Input { | ||
/** This is the name of the component prop this input represents */ | ||
name: string; | ||
/** A friendlier name to show in the UI if the component prop name is not ideal for end users */ | ||
friendlyName?: string; | ||
/** @hidden @deprecated */ | ||
description?: string; | ||
/** A default value to use */ | ||
defaultValue?: any; | ||
/** | ||
* The type of input to use, such as 'text' | ||
* | ||
* See all available inputs [here](https://www.builder.io/c/docs/custom-react-components#input-types) | ||
* and you can create your own custom input types and associated editor UIs with [plugins](https://www.builder.io/c/docs/extending/plugins) | ||
*/ | ||
type: string; | ||
/** Is this input mandatory or not */ | ||
required?: boolean; | ||
/** @hidden */ | ||
autoFocus?: boolean; | ||
subFields?: Input[]; | ||
/** | ||
* Additional text to render in the UI to give guidance on how to use this | ||
* | ||
* @example | ||
* ```js | ||
* helperText: 'Be sure to use a proper URL, starting with "https://"' | ||
* 111 | ||
*/ | ||
helperText?: string; | ||
/** @hidden */ | ||
allowedFileTypes?: string[]; | ||
/** @hidden */ | ||
imageHeight?: number; | ||
/** @hidden */ | ||
imageWidth?: number; | ||
/** @hidden */ | ||
mediaHeight?: number; | ||
/** @hidden */ | ||
mediaWidth?: number; | ||
/** @hidden */ | ||
hideFromUI?: boolean; | ||
/** @hidden */ | ||
modelId?: string; | ||
@@ -293,5 +383,9 @@ /** | ||
bubble?: boolean; | ||
/** @hidden */ | ||
options?: { | ||
[key: string]: any; | ||
}; | ||
/** | ||
* For "text" input type, specifying an enum will show a dropdown of options instead | ||
*/ | ||
enum?: string[] | { | ||
@@ -314,9 +408,30 @@ label: string; | ||
}; | ||
/** | ||
* Set this to `true` to put this under the "show more" section of | ||
* the options editor. Useful for things that are more advanced | ||
* or more rarely used and don't need to be too prominent | ||
*/ | ||
advanced?: boolean; | ||
/** @hidden */ | ||
onChange?: Function | string; | ||
/** @hidden */ | ||
code?: boolean; | ||
/** @hidden */ | ||
richText?: boolean; | ||
/** @hidden */ | ||
showIf?: ((options: Map<string, any>) => boolean) | string; | ||
/** @hidden */ | ||
copyOnAdd?: boolean; | ||
} | ||
/** | ||
* This is the interface for the options for `Builder.registerComponent` | ||
* | ||
* ```js | ||
* Builder.registerComponent(YourComponent, { | ||
* // <- Component options | ||
* }) | ||
* ``` | ||
* | ||
* Learn more about registering custom components [here](https://www.builder.io/c/docs/custom-react-components) | ||
*/ | ||
export interface Component { | ||
@@ -328,2 +443,3 @@ /** | ||
name: string; | ||
/** @hidden @deprecated */ | ||
description?: string; | ||
@@ -334,9 +450,38 @@ /** | ||
docsLink?: string; | ||
/** | ||
* Link to an image to be used as an icon for this component in Builder's editor | ||
* | ||
* @example | ||
* ```js | ||
* image: 'https://some-cdn.com/my-icon-for-this-component.png' | ||
* ``` | ||
*/ | ||
image?: string; | ||
/** | ||
* Input schema for your component for users to fill in the options | ||
* Link to a screenshot shown when user hovers over the component in Builder's editor | ||
* use https://builder.io/upload to upload your screeshot, for easier resizing by Builder. | ||
*/ | ||
screenshot?: string; | ||
/** | ||
* Input schema for your component for users to fill in the options via a UI | ||
* that translate to this components props | ||
*/ | ||
inputs?: Input[]; | ||
/** @hidden @deprecated */ | ||
class?: any; | ||
/** @hidden @deprecated */ | ||
type?: 'angular' | 'webcomponent' | 'react' | 'vue'; | ||
/** | ||
* Default styles to apply when droppged into the Builder.io editor | ||
* | ||
* @example | ||
* ```js | ||
* defaultStyles: { | ||
* // large (default) breakpoint | ||
* large: { | ||
* backgroundColor: 'black' | ||
* }, | ||
* } | ||
* ``` | ||
*/ | ||
defaultStyles?: { | ||
@@ -351,2 +496,3 @@ [key: string]: string; | ||
canHaveChildren?: boolean; | ||
/** @hidden */ | ||
fragment?: boolean; | ||
@@ -362,3 +508,7 @@ /** | ||
defaultChildren?: BuilderElement[]; | ||
/** | ||
* Default options to merge in when creating this block | ||
*/ | ||
defaults?: Partial<BuilderElement>; | ||
/** @hidden @deprecated */ | ||
hooks?: { | ||
@@ -371,3 +521,5 @@ [key: string]: string | Function; | ||
hideFromInsertMenu?: boolean; | ||
/** Custom tag name (for custom webcomponents only) */ | ||
tag?: string; | ||
/** @hidden @deprecated */ | ||
static?: boolean; | ||
@@ -418,3 +570,3 @@ /** | ||
}; | ||
/** not yet implemented */ | ||
/** @hidden @deprecated */ | ||
friendlyName?: string; | ||
@@ -437,2 +589,25 @@ /** | ||
} | ||
/** | ||
* Use this to register custom sections in the Insert menu, for instance | ||
* to make new sections to organize your custom components | ||
* | ||
* ![Example of what a custom section looks like](https://cdn.builder.io/api/v1/image/assets%2F7f7bbcf72a1a4d72bac5daa359e7befd%2Fe5f2792e9c0f44ed89a9dcb77b945858) | ||
* | ||
* @example | ||
* ```js | ||
* Builder.register('insertMenu', { | ||
* name: 'Our components', | ||
* items: [ | ||
* { name: 'Hero' }, | ||
* { name: 'Double Columns' }, | ||
* { name: 'Triple Columns' }, | ||
* { name: 'Dynamic Columns' }, | ||
* ], | ||
* }) | ||
* ``` | ||
* | ||
* You can make as many custom sections as you like | ||
* | ||
* See a complete usage example [here](https://github.com/builderio/builder/blob/main/examples/react-design-system/src/builder-settings.js) | ||
*/ | ||
export interface InsertMenuConfig { | ||
@@ -456,2 +631,6 @@ name: string; | ||
protected response?: ServerResponse | undefined; | ||
/** | ||
* @hidden | ||
* @deprecated. This is buggy, and always behind by a version. | ||
*/ | ||
static VERSION: string; | ||
@@ -503,2 +682,8 @@ static components: Component[]; | ||
static settingsChange: BehaviorSubject<any, any>; | ||
/** | ||
* @deprecated | ||
* @hidden | ||
* | ||
* Use Builder.register('editor.settings', {}) instead. | ||
*/ | ||
static set(settings: Settings): void; | ||
@@ -505,0 +690,0 @@ static import(packageName: string): any; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Animator = void 0; | ||
var throttle_function_1 = require("../functions/throttle.function"); | ||
var assign_function_1 = require("../functions/assign.function"); | ||
var camelCaseToKebabCase = function (str) { | ||
return str ? str.replace(/([A-Z])/g, function (g) { return "-" + g[0].toLowerCase(); }) : ''; | ||
return str ? str.replace(/([A-Z])/g, function (g) { return "-".concat(g[0].toLowerCase()); }) : ''; | ||
}; | ||
@@ -28,3 +29,3 @@ var Animator = /** @class */ (function () { | ||
Animator.prototype.warnElementNotPresent = function (id) { | ||
console.warn("Cannot animate element: element with ID " + id + " not found!"); | ||
console.warn("Cannot animate element: element with ID ".concat(id, " not found!")); | ||
}; | ||
@@ -80,3 +81,3 @@ Animator.prototype.augmentAnimation = function (animation, element) { | ||
element.style.transitionDelay = '0'; | ||
assign_function_1.assign(element.style, animation.steps[0].styles); | ||
(0, assign_function_1.assign)(element.style, animation.steps[0].styles); | ||
// TODO: queue/batch these timeouts | ||
@@ -86,7 +87,7 @@ // TODO: only include properties explicitly set in the animation | ||
setTimeout(function () { | ||
element.style.transition = "all " + animation.duration + "s " + camelCaseToKebabCase(animation.easing); | ||
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing)); | ||
if (animation.delay) { | ||
element.style.transitionDelay = animation.delay + 's'; | ||
} | ||
assign_function_1.assign(element.style, animation.steps[1].styles); | ||
(0, assign_function_1.assign)(element.style, animation.steps[1].styles); | ||
// TODO: maybe remove/reset transitoin property after animation duration | ||
@@ -117,6 +118,6 @@ // TODO: queue timers | ||
function attachDefaultState() { | ||
assign_function_1.assign(element.style, defaultState); | ||
(0, assign_function_1.assign)(element.style, defaultState); | ||
} | ||
function attachHoverState() { | ||
assign_function_1.assign(element.style, hoverState); | ||
(0, assign_function_1.assign)(element.style, hoverState); | ||
} | ||
@@ -128,3 +129,3 @@ attachDefaultState(); | ||
setTimeout(function () { | ||
element.style.transition = "all " + animation.duration + "s " + camelCaseToKebabCase(animation.easing); | ||
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing)); | ||
if (animation.delay) { | ||
@@ -153,3 +154,3 @@ element.style.transitionDelay = animation.delay + 's'; | ||
setTimeout(function () { | ||
assign_function_1.assign(element.style, animation.steps[1].styles); | ||
(0, assign_function_1.assign)(element.style, animation.steps[1].styles); | ||
document.removeEventListener('scroll', onScroll); | ||
@@ -164,3 +165,3 @@ setTimeout(function () { | ||
// TODO: roll all of these in one for more efficiency of checking all the rects | ||
var onScroll = throttle_function_1.throttle(immediateOnScroll, 200, { leading: false }); | ||
var onScroll = (0, throttle_function_1.throttle)(immediateOnScroll, 200, { leading: false }); | ||
// TODO: fully in view or partially | ||
@@ -180,3 +181,3 @@ function isScrolledIntoView(elem) { | ||
function attachDefaultState() { | ||
assign_function_1.assign(element.style, defaultState); | ||
(0, assign_function_1.assign)(element.style, defaultState); | ||
} | ||
@@ -186,3 +187,3 @@ attachDefaultState(); | ||
setTimeout(function () { | ||
element.style.transition = "all " + animation.duration + "s " + camelCaseToKebabCase(animation.easing); | ||
element.style.transition = "all ".concat(animation.duration, "s ").concat(camelCaseToKebabCase(animation.easing)); | ||
if (animation.delay) { | ||
@@ -189,0 +190,0 @@ element.style.transitionDelay = animation.delay + 's'; |
@@ -48,3 +48,3 @@ "use strict"; | ||
} | ||
cookie.domain = req.headers.host && get_top_level_domain_1.getTopLevelDomain(req.headers.host); | ||
cookie.domain = req.headers.host && (0, get_top_level_domain_1.getTopLevelDomain)(req.headers.host); | ||
pushCookie(headers, cookie); | ||
@@ -86,3 +86,3 @@ var setHeader = res.setHeader; | ||
Cookie.prototype.toString = function () { | ||
return this.name + "=" + this.value; | ||
return "".concat(this.name, "=").concat(this.value); | ||
}; | ||
@@ -95,12 +95,12 @@ Cookie.prototype.toHeader = function () { | ||
if (this.path) { | ||
header += "; path=" + this.path; | ||
header += "; path=".concat(this.path); | ||
} | ||
if (this.expires) { | ||
header += "; expires=" + this.expires.toUTCString(); | ||
header += "; expires=".concat(this.expires.toUTCString()); | ||
} | ||
if (this.domain) { | ||
header += "; domain=" + this.domain; | ||
header += "; domain=".concat(this.domain); | ||
} | ||
// TODO: samesite=none by default (?) | ||
header += "; SameSite=" + (this.sameSite === true ? 'strict' : 'None'); | ||
header += "; SameSite=".concat(this.sameSite === true ? 'strict' : 'None'); | ||
// TODO: On by default | ||
@@ -118,3 +118,3 @@ if (this.secure) { | ||
function getPattern(name) { | ||
return new RegExp("(?:^|;) *" + name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') + "=([^;]*)"); | ||
return new RegExp("(?:^|;) *".concat(name.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'), "=([^;]*)")); | ||
} | ||
@@ -124,3 +124,3 @@ function pushCookie(headers, cookie) { | ||
for (var i = headers.length - 1; i >= 0; i--) { | ||
if (headers[i].indexOf(cookie.name + "=") === 0) { | ||
if (headers[i].indexOf("".concat(cookie.name, "=")) === 0) { | ||
headers.splice(i, 1); | ||
@@ -127,0 +127,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Observable = exports.Observer = exports.BehaviorSubject = exports.Subscription = void 0; | ||
var Subscription = /** @class */ (function () { | ||
@@ -14,3 +15,3 @@ function Subscription(listeners, listener) { | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -17,0 +18,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TinyPromise = void 0; | ||
var next_tick_function_1 = require("../functions/next-tick.function"); | ||
@@ -99,3 +100,3 @@ var State = { | ||
_this._addHandler(function (value) { | ||
next_tick_function_1.nextTick(function () { | ||
(0, next_tick_function_1.nextTick)(function () { | ||
try { | ||
@@ -114,3 +115,3 @@ if (isFunction(onFulfilled)) { | ||
}, function (error) { | ||
next_tick_function_1.nextTick(function () { | ||
(0, next_tick_function_1.nextTick)(function () { | ||
try { | ||
@@ -133,3 +134,3 @@ if (isFunction(onRejected)) { | ||
return new TinyPromise(function (resolve, reject) { | ||
next_tick_function_1.nextTick(function () { | ||
(0, next_tick_function_1.nextTick)(function () { | ||
try { | ||
@@ -151,3 +152,3 @@ if (isFunction(onFulfilled)) { | ||
return new TinyPromise(function (resolve, reject) { | ||
next_tick_function_1.nextTick(function () { | ||
(0, next_tick_function_1.nextTick)(function () { | ||
try { | ||
@@ -154,0 +155,0 @@ if (isFunction(onRejected)) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.QueryString = void 0; | ||
var PROPERTY_NAME_DENY_LIST = Object.freeze(['__proto__', 'prototype', 'constructor']); | ||
@@ -80,4 +81,4 @@ // TODO: unit tests | ||
if (PROPERTY_NAME_DENY_LIST.indexOf(name) >= 0) | ||
throw new Error("Property name \"" + name + "\" is not allowed"); | ||
throw new Error("Property name \"".concat(name, "\" is not allowed")); | ||
} | ||
//# sourceMappingURL=query-string.class.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.builder = void 0; | ||
var builder_class_1 = require("../builder.class"); | ||
@@ -4,0 +5,0 @@ exports.builder = new builder_class_1.Builder(null, undefined, undefined, true); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.assign = void 0; | ||
function assign(target) { | ||
@@ -4,0 +5,0 @@ var args = []; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.fetch = exports.tinyFetch = void 0; | ||
var promise_class_1 = __importDefault(require("../classes/promise.class")); | ||
@@ -41,3 +42,3 @@ var server_only_require_function_1 = __importDefault(require("./server-only-require.function")); | ||
header = headers[key]; | ||
headers[key] = header ? header + "," + value : value; | ||
headers[key] = header ? "".concat(header, ",").concat(value) : value; | ||
return ''; | ||
@@ -68,3 +69,3 @@ }); | ||
: typeof window === 'undefined' | ||
? server_only_require_function_1.default('node-fetch') | ||
? (0, server_only_require_function_1.default)('node-fetch') | ||
: typeof window.fetch !== 'undefined' | ||
@@ -71,0 +72,0 @@ ? window.fetch |
@@ -40,8 +40,10 @@ "use strict"; | ||
}; | ||
var __spreadArrays = (this && this.__spreadArrays) || function () { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
@@ -179,6 +181,6 @@ var __values = (this && this.__values) || function(o) { | ||
if (node.level === level - 1) { | ||
query = path[i].name + " > " + query; | ||
query = "".concat(path[i].name, " > ").concat(query); | ||
} | ||
else { | ||
query = path[i].name + " " + query; | ||
query = "".concat(path[i].name, " ").concat(query); | ||
} | ||
@@ -195,3 +197,3 @@ node = path[i]; | ||
case 0: | ||
throw new Error("Can't select any node with this selector: " + selector(path)); | ||
throw new Error("Can't select any node with this selector: ".concat(selector(path))); | ||
case 1: | ||
@@ -259,3 +261,3 @@ return true; | ||
return { | ||
name: node.name + (":nth-child(" + i + ")"), | ||
name: node.name + ":nth-child(".concat(i, ")"), | ||
penalty: node.penalty + 1, | ||
@@ -322,3 +324,3 @@ }; | ||
if (!(i < path.length - 1)) return [3 /*break*/, 5]; | ||
newPath = __spreadArrays(path); | ||
newPath = __spreadArray([], path, true); | ||
newPath.splice(i, 1); | ||
@@ -325,0 +327,0 @@ if (!(unique(newPath) && same(newPath, input))) return [3 /*break*/, 4]; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getTopLevelDomain = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * Only gets one level up from hostname |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.nextTick = void 0; | ||
var isSafari = typeof window !== 'undefined' && | ||
@@ -4,0 +5,0 @@ /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.omit = void 0; | ||
function omit(obj) { | ||
@@ -4,0 +5,0 @@ var values = []; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.throttle = void 0; | ||
function throttle(func, wait, options) { | ||
@@ -4,0 +5,0 @@ if (options === void 0) { options = {}; } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uuid = exports.uuidv4 = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * @credit https://stackoverflow.com/a/2117523 |
@@ -7,3 +7,5 @@ declare type JSONValue = string | number | boolean | JSONObject | JSONArray; | ||
} | ||
/** @todo typedoc this */ | ||
/** | ||
* An object representing an element in Builder | ||
*/ | ||
export interface BuilderElement { | ||
@@ -17,3 +19,3 @@ '@type': '@builder.io/sdk:Element'; | ||
layerLocked?: boolean; | ||
/** @todo make alias for properties.class */ | ||
/** @deprecated @hidden */ | ||
class?: string; | ||
@@ -20,0 +22,0 @@ children?: BuilderElement[]; |
@@ -26,3 +26,3 @@ /* | ||
// The directory where Jest should output its coverage files | ||
coverageDirectory: "coverage", | ||
coverageDirectory: 'coverage', | ||
@@ -35,3 +35,3 @@ // An array of regexp pattern strings used to skip coverage collection | ||
// Indicates which provider should be used to instrument code for coverage | ||
coverageProvider: "v8", | ||
coverageProvider: 'v8', | ||
@@ -142,3 +142,3 @@ // A list of reporter names that Jest uses when writing coverage reports | ||
// The test environment that will be used for testing | ||
testEnvironment: "jsdom", | ||
testEnvironment: 'jsdom', | ||
@@ -179,3 +179,3 @@ // Options that will be passed to the testEnvironment | ||
transform: { | ||
"\\.ts$": "esbuild-runner/jest" | ||
'\\.ts$': 'esbuild-runner/jest', | ||
}, | ||
@@ -182,0 +182,0 @@ |
{ | ||
"name": "@builder.io/sdk", | ||
"version": "1.1.27-0", | ||
"version": "1.1.27-1", | ||
"unpkg": "./dist/index.browser.js", | ||
@@ -16,2 +16,5 @@ "main": "./dist/index.cjs.js", | ||
"_install": "npm install", | ||
"docs": "npm run docs:generate && npm run docs:cleanup", | ||
"docs:generate": "typedoc", | ||
"docs:cleanup": "node scripts/cleanup-generated-docs", | ||
"build": "npm run tsc && rollup -c", | ||
@@ -45,2 +48,4 @@ "watch": "rollup -cw", | ||
"esbuild-runner": "2.2.1", | ||
"glob": "^7.2.3", | ||
"glob-promise": "^4.2.2", | ||
"jest": "27.4.7", | ||
@@ -58,3 +63,5 @@ "rollup": "^0.58.2", | ||
"rollup-plugin-uglify": "^3.0.0", | ||
"typescript": "^3.8.3" | ||
"typedoc": "^0.22.15", | ||
"typedoc-plugin-markdown": "^3.12.1", | ||
"typescript": "^4.6.4" | ||
}, | ||
@@ -61,0 +68,0 @@ "dependencies": { |
@@ -34,5 +34,4 @@ # Builder Core | ||
}) | ||
.promise() | ||
.then(({ data }) => { | ||
// Do something with the data | ||
.then(results => { | ||
// Do something with the results | ||
}); | ||
@@ -44,2 +43,4 @@ | ||
If you have questions or comments, don't hesitate to reach out by creating an issue or emailing steve@builder.io | ||
View all options for `builder.get` [here](./docs/interfaces/GetContentOptions.md) | ||
If you have questions or comments, don't hesitate to reach out by creating an issue or emailing support@builder.io |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1336322
87
11865
45
32
1