@widgetic/embed-sdk 2.0.8 → 2.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{_ as t}from"./vendor.js";import{l as e,c as i,n as o}from"./core.js";import{Configuration as n,AuthenticationApi as s,CompositionsApi as r}from"@widgetic/api-sdk";import{getMessenger as a}from"./messaging.js";const d=t=>null!==t&&"object"==typeof t&&!Array.isArray(t)&&"[object Object]"===Object.prototype.toString.call(t);function c(t){if(Array.isArray(t))return t.map(c);if(!d(t))return t;const e={};for(const[i,o]of Object.entries(t)){e[i.replace(/[_-](\w)/g,((t,e)=>e?e.toUpperCase():""))]=Array.isArray(o)?o.map(c):d(o)?c(o):o}return e}function l(t){if(Array.isArray(t))return t.map(l);if(!d(t))return t;const e={};for(const[i,o]of Object.entries(t)){e[i.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toLowerCase()]=Array.isArray(o)?o.map(l):d(o)?l(o):o}return e}class h{constructor(){this.sessionCache=null,this.sessionCacheExpiry=0,this.ownershipCache=new Map;const t=o(),e=new n({basePath:t.basePath,apiKey:t.apiKey,credentials:"include"});this.authApi=new s(e),this.compositionsApi=new r(e)}checkAuthentication(){return t(this,void 0,void 0,(function*(){try{if(this.sessionCache&&Date.now()<this.sessionCacheExpiry)return{isAuthenticated:!0,session:this.sessionCache,user:this.sessionCache.user,canEdit:!0};const t=c(yield this.authApi.getSession());return t&&t.accessToken&&t.user?(this.sessionCache=t,this.sessionCacheExpiry=Date.now()+3e5,e.info("User authenticated for editing",{userId:t.user.id,email:t.user.email}),{isAuthenticated:!0,session:t,user:t.user,canEdit:!0}):{isAuthenticated:!1,canEdit:!1}}catch(t){return e.debug("Authentication check failed",{error:t}),t instanceof Response&&t.status,{isAuthenticated:!1,canEdit:!1}}}))}checkCompositionOwnership(i){return t(this,void 0,void 0,(function*(){var t;try{const o=this.ownershipCache.get(i);if(o)return o;const n=yield this.checkAuthentication();if(!n.isAuthenticated||!(null===(t=n.session)||void 0===t?void 0:t.user)){const t={isOwner:!1,canEdit:!1,error:"User not authenticated"};return this.ownershipCache.set(i,t),t}const s=c(yield this.compositionsApi.getCompositionById({id:i}));if(!s){const t={isOwner:!1,canEdit:!1,error:"Composition not found"};return this.ownershipCache.set(i,t),t}const r=s.creatorId===n.session.user.id,a={isOwner:r,canEdit:r,composition:s,error:r?void 0:"User does not own this composition"};return this.ownershipCache.set(i,a),setTimeout((()=>{this.ownershipCache.delete(i)}),12e4),e.debug("Composition ownership checked",{compositionId:i,isOwner:r,userId:n.session.user.id,compositionCreatorId:s.creatorId}),a}catch(t){e.warn("Failed to check composition ownership",{compositionId:i,error:t});const o={isOwner:!1,canEdit:!1,error:t instanceof Error?t.message:"Unknown error"};return this.ownershipCache.set(i,o),o}}))}canEditComposition(e){return t(this,void 0,void 0,(function*(){return(yield this.checkCompositionOwnership(e)).canEdit}))}getCurrentUser(){return t(this,void 0,void 0,(function*(){return(yield this.checkAuthentication()).user||null}))}clearCache(){this.sessionCache=null,this.sessionCacheExpiry=0,this.ownershipCache.clear(),e.debug("Authentication cache cleared")}checkMultipleCompositions(e){return t(this,void 0,void 0,(function*(){const i=new Map;return(yield this.checkAuthentication()).isAuthenticated?(yield Promise.all(e.map((e=>t(this,void 0,void 0,(function*(){const t=yield this.checkCompositionOwnership(e);i.set(e,t)}))))),i):(e.forEach((t=>{i.set(t,{isOwner:!1,canEdit:!1,error:"User not authenticated"})})),i)}))}isEditingEnabled(){return i.ENABLE_EDITING}}let u=null;function p(){return u||(u=new h),u}class g{constructor(t={}){this.host=null,this.container=null,this.content=null,this.destroyed=!1,this.options=Object.assign({target:"widgetic-portal",className:"",style:"",clickThrough:!1,zIndex:99999999},t),this.createPortal()}createPortal(){this.host=this.findOrCreateHost(),this.container=document.createElement("div"),this.container.className=(this.options.className?this.options.className+" ":"")+"widgetic-portal-contents",this.container.style.cssText=`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: ${this.options.zIndex};\n pointer-events: ${this.options.clickThrough?"none":"auto"};\n ${this.options.style}\n `,this.options.clickThrough?this.container.style.pointerEvents="none":this.container.style.pointerEvents="auto",this.host.appendChild(this.container),e.debug("Portal created",{target:this.options.target,host:this.host,container:this.container})}findOrCreateHost(){let t=null;if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){const e=`.${this.options.target}`;t=document.querySelector(e)}return t||(t=document.createElement("div"),t.classList.add("string"==typeof this.options.target?this.options.target:"widgetic-portal"),document.body.appendChild(t),e.debug("Portal host created",{target:this.options.target,host:t})),t}mount(t){this.destroyed?e.warn("Cannot mount content to destroyed portal"):this.container?(this.content&&this.unmount(),t.style.pointerEvents="auto",this.content=t,this.container.appendChild(t),e.debug("Content mounted to portal",{content:t})):e.error("Portal container not available")}unmount(){this.content&&this.container&&this.container.contains(this.content)&&(this.container.removeChild(this.content),this.content=null,e.debug("Content unmounted from portal"))}destroy(){if(!this.destroyed){if(this.unmount(),this.container&&this.host&&this.host.contains(this.container)&&this.host.removeChild(this.container),this.host&&0===this.host.childNodes.length&&this.host.parentNode){const t="string"==typeof this.options.target?this.options.target:"widgetic-portal";this.host.classList.contains(t)&&this.host.parentNode.removeChild(this.host)}this.destroyed=!0,this.host=null,this.container=null,this.content=null,e.debug("Portal destroyed")}}getContainer(){return this.container}isDestroyed(){return this.destroyed}updateOptions(t){this.destroyed?e.warn("Cannot update options on destroyed portal"):(this.options=Object.assign(Object.assign({},this.options),t),this.container&&(void 0!==t.className&&(this.container.className=(t.className?t.className+" ":"")+"widgetic-portal-contents"),void 0!==t.style&&(this.container.style.cssText=`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: ${this.options.zIndex};\n pointer-events: ${this.options.clickThrough,"none"};\n ${this.options.style}\n `),void 0!==t.clickThrough&&(this.container.style.pointerEvents=(t.clickThrough,"none"))),e.debug("Portal options updated",{options:this.options}))}}function m(t){return new g(t)}class y{constructor(t={}){this.config=t,this.loadPromise=null,this.sdkInstance=null,this.isLoading=!1,this.loadTimeout=3e4,this.config=Object.assign({basePath:t.basePath||this.getUISdkBaseUrl(),version:t.version||"latest",debug:t.debug||!1},t)}getUISdkBaseUrl(){return"development"===i.NODE_ENV?i.CLIENT_URL:`${i.PRODUCTION_URL}/ui-sdk`}loadUISdk(){return t(this,void 0,void 0,(function*(){if(this.sdkInstance)return this.sdkInstance;if(this.loadPromise)return this.loadPromise;this.isLoading=!0,this.loadPromise=this.performLoad();try{return this.sdkInstance=yield this.loadPromise,e.info("UI SDK loaded successfully",{basePath:this.config.basePath,version:this.config.version}),this.sdkInstance}catch(t){throw e.error("Failed to load UI SDK",{error:t,config:this.config}),this.loadPromise=null,t}finally{this.isLoading=!1}}))}performLoad(){return t(this,void 0,void 0,(function*(){return new Promise(((t,i)=>{const o=setTimeout((()=>{i(new Error("UI SDK load timeout"))}),this.loadTimeout);try{if(window.WidgeticUI)return clearTimeout(o),void t(window.WidgeticUI);const n=document.createElement("script");n.src=`${this.config.basePath}/widgetic-ui.js`,n.async=!0,n.crossOrigin="anonymous",n.onload=()=>{clearTimeout(o),window.WidgeticUI?(e.debug("UI SDK script loaded from external source"),t(window.WidgeticUI)):i(new Error("UI SDK script loaded but WidgeticUI not available"))},n.onerror=()=>{clearTimeout(o),i(new Error("Failed to load UI SDK script"))},document.head.appendChild(n),e.debug("Loading UI SDK",{src:n.src})}catch(t){clearTimeout(o),i(t)}}))}))}isLoaded(){return null!==this.sdkInstance}isLoadingState(){return this.isLoading}getInstance(){return this.sdkInstance}initializeUISdk(i){return t(this,void 0,void 0,(function*(){const t=yield this.loadUISdk();return yield t.init(Object.assign(Object.assign({},this.config),i)),e.info("UI SDK initialized",{config:Object.assign(Object.assign({},this.config),i)}),t}))}cleanup(){return t(this,void 0,void 0,(function*(){if(this.sdkInstance){try{yield this.sdkInstance.destroy()}catch(t){e.warn("Error during UI SDK cleanup",{error:t})}this.sdkInstance=null}this.loadPromise=null,this.isLoading=!1,window.WidgeticUI&&delete window.WidgeticUI,e.debug("UI SDK cleanup complete")}))}preload(){return t(this,void 0,void 0,(function*(){try{yield this.loadUISdk(),e.debug("UI SDK preloaded successfully")}catch(t){e.warn("UI SDK preload failed",{error:t})}}))}}let v=null;function f(t){return v||(v=new y(t)),v}class w{constructor(t={}){this.options=t,this.sessions=new Map,this.defaultOptions={showEditButton:!0,editButtonText:"✏️ Edit",editButtonPosition:"top-right",enableClickToEdit:!0,autoDetectAuth:!0},this.options=Object.assign(Object.assign({},this.defaultOptions),t)}addOverlay(i,o){return t(this,void 0,void 0,(function*(){try{if(!this.options.autoDetectAuth)return void(yield this.createOverlay(i,o,!0));const t=p(),n=yield t.checkCompositionOwnership(o);n.canEdit?(yield this.createOverlay(i,o,!0),e.debug("Editor overlay added for owned composition",{compositionId:o})):e.debug("Editor overlay not added - user cannot edit",{compositionId:o,reason:n.error})}catch(t){e.warn("Failed to add editor overlay",{compositionId:o,error:t})}}))}createOverlay(i,o,n){return t(this,void 0,void 0,(function*(){if(this.sessions.has(o))return;const t=document.createElement("div");if(t.className="widgetic-editor-overlay",t.style.cssText=`\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 10000;\n pointer-events: none;\n ${this.getOverlayStyles()}\n `,this.options.showEditButton&&n){const e=this.createEditButton(o);t.appendChild(e)}this.options.enableClickToEdit&&n&&this.addClickToEdit(t,o);const s=i.parentElement;if(s){"static"===window.getComputedStyle(s).position&&(s.style.position="relative"),s.appendChild(t)}else i.style.position="relative",i.appendChild(t);const r={compositionId:o,isOpen:!1,overlay:t};this.sessions.set(o,r),e.debug("Editor overlay created",{compositionId:o})}))}createEditButton(e){const i=document.createElement("button");return i.className="widgetic-edit-button",i.textContent=this.options.editButtonText||"✏️ Edit",i.style.cssText=`\n position: absolute;\n ${this.getButtonPositionStyles()}\n background: #007bff;\n color: white;\n border: none;\n border-radius: 4px;\n padding: 8px 12px;\n font-size: 12px;\n font-weight: 500;\n cursor: pointer;\n pointer-events: auto;\n box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n transition: all 0.2s ease;\n z-index: 10001;\n ${this.getCustomButtonStyles()}\n `,i.addEventListener("mouseenter",(()=>{i.style.background="#0056b3",i.style.transform="scale(1.05)"})),i.addEventListener("mouseleave",(()=>{i.style.background="#007bff",i.style.transform="scale(1)"})),i.addEventListener("click",(i=>t(this,void 0,void 0,(function*(){i.preventDefault(),i.stopPropagation(),yield this.openEditor(e)})))),i}getButtonPositionStyles(){const t="10px";switch(this.options.editButtonPosition||"top-right"){case"top-left":return`top: ${t}; left: ${t};`;case"top-right":default:return`top: ${t}; right: ${t};`;case"bottom-left":return`bottom: ${t}; left: ${t};`;case"bottom-right":return`bottom: ${t}; right: ${t};`}}getCustomButtonStyles(){return this.options.editButtonStyle?Object.entries(this.options.editButtonStyle).map((([t,e])=>`${this.camelToKebab(t)}: ${e};`)).join(" "):""}getOverlayStyles(){return this.options.overlayStyle?Object.entries(this.options.overlayStyle).map((([t,e])=>`${this.camelToKebab(t)}: ${e};`)).join(" "):""}camelToKebab(t){return t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}addClickToEdit(e,i){e.style.cursor="pointer",e.style.pointerEvents="auto",e.addEventListener("click",(o=>t(this,void 0,void 0,(function*(){o.target===e&&(o.preventDefault(),o.stopPropagation(),yield this.openEditor(i))})))),e.addEventListener("mouseenter",(()=>{e.style.backgroundColor="rgba(0, 123, 255, 0.1)",e.style.border="2px dashed #007bff"})),e.addEventListener("mouseleave",(()=>{e.style.backgroundColor="transparent",e.style.border="none"}))}createEditorContainer(){const t=new g({target:"widgetic-editor-portal",className:"widgetic-editor-modal",zIndex:1e5,clickThrough:!1});const e=document.createElement("div");e.className="widgetic-editor-modal-backdrop",e.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n ";const i=document.createElement("div");return i.className="widgetic-editor-content",i.style.cssText="\n width: 90vw;\n height: 90vh;\n max-width: 1200px;\n max-height: 800px;\n background: white;\n border-radius: 8px;\n overflow: hidden;\n position: relative;\n ",e.appendChild(i),t.mount(e),{container:e,portal:t}}openEditor(i){return t(this,void 0,void 0,(function*(){try{const t=this.sessions.get(i);if(!t)return void e.warn("No editor session found",{compositionId:i});if(t.isOpen)return void e.debug("Editor already open",{compositionId:i});e.info("Opening composition editor",{compositionId:i});const o=f(),n=yield o.initializeUISdk(),{container:s,portal:r}=this.createEditorContainer(),d=yield n.mountCompositionEditor(s.querySelector(".widgetic-editor-content"),i,{onSave:t=>this.handleEditorSave(i,t),onClose:()=>this.closeEditor(i),onPreview:t=>this.handleEditorPreview(i,t)}),c=a().createWidgetController(i);if(t.isOpen=!0,t.editorContainer=s,t.editorInstance=d,t.widgetController=c,t.portal=r,t.overlay){const e=t.overlay.querySelector(".widgetic-edit-button");e&&(e.style.display="none")}e.info("Composition editor opened successfully",{compositionId:i})}catch(t){e.error("Failed to open editor",{compositionId:i,error:t}),this.showError("Failed to open editor. Please try again.",i)}}))}handleEditorSave(i,o){return t(this,void 0,void 0,(function*(){try{e.info("Saving composition changes",{compositionId:i,data:o});const t=this.sessions.get(i);(null==t?void 0:t.widgetController)&&(yield t.widgetController.updateConfig(o),yield t.widgetController.refresh()),yield this.closeEditor(i),e.info("Composition saved successfully",{compositionId:i})}catch(t){e.error("Failed to save composition",{compositionId:i,error:t}),this.showError("Failed to save changes. Please try again.",i)}}))}handleEditorPreview(i,o){return t(this,void 0,void 0,(function*(){try{const t=this.sessions.get(i);(null==t?void 0:t.widgetController)&&(yield t.widgetController.callFunction("preview",o))}catch(t){e.warn("Preview update failed",{compositionId:i,error:t})}}))}closeEditor(i){return t(this,void 0,void 0,(function*(){const t=this.sessions.get(i);if(t&&t.isOpen)try{if(t.editorInstance&&t.editorContainer){const e=f().getInstance();e&&(yield e.unmountCompositionEditor(t.editorContainer))}if(t.portal&&t.portal.destroy(),t.overlay){const e=t.overlay.querySelector(".widgetic-edit-button");e&&(e.style.display="block")}t.isOpen=!1,t.editorContainer=void 0,t.editorInstance=void 0,t.portal=void 0,e.info("Editor closed",{compositionId:i})}catch(t){e.error("Error closing editor",{compositionId:i,error:t})}}))}showError(t,e){const i=document.createElement("div");i.style.cssText="\n position: fixed;\n top: 20px;\n right: 20px;\n background: #dc3545;\n color: white;\n padding: 12px 16px;\n border-radius: 4px;\n z-index: 100001;\n font-size: 14px;\n max-width: 300px;\n ",i.textContent=t,document.body.appendChild(i),setTimeout((()=>{i.parentNode&&i.parentNode.removeChild(i)}),5e3)}removeOverlay(t){const i=this.sessions.get(t);i&&(i.isOpen&&this.closeEditor(t),i.overlay&&i.overlay.parentNode&&i.overlay.parentNode.removeChild(i.overlay),i.portal&&i.portal.destroy(),this.sessions.delete(t),e.debug("Editor overlay removed",{compositionId:t}))}isEditorOpen(t){var e;return(null===(e=this.sessions.get(t))||void 0===e?void 0:e.isOpen)||!1}getActiveSessions(){return Array.from(this.sessions.keys())}cleanup(){for(const t of this.sessions.keys())this.removeOverlay(t);e.debug("Editor overlay cleanup complete")}}let b=null;function E(t){return b||(b=new w(t)),b}var C=Object.freeze({__proto__:null,EditorOverlay:w,getEditorOverlay:E,resetEditorOverlay:function(){b&&(b.cleanup(),b=null)}});export{E as a,f as b,m as c,c as d,C as e,p as g,l as t};
1
+ import{_ as e}from"./vendor.js";import{c as t,l as n,a as i}from"./core.js";import{getMessenger as o}from"./messaging.js";var r="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))};const s="https://api.widgetic.com/v1".replace(/\/+$/,"");class a{constructor(e){if(this.configuration={basePath:s,headers:{},middleware:[]},"string"==typeof e){const t=(null==e?void 0:e.startsWith("Bearer "))?e.slice(7):e;this.configuration.apiKey=e=>r(this,void 0,void 0,(function*(){return"authorization"===(null==e?void 0:e.toLowerCase())?`Bearer ${t}`:t})),this.configuration.accessToken=()=>r(this,void 0,void 0,(function*(){return t})),this.configuration.headers={"Content-Type":"application/json"}}else if(e){this.configuration=Object.assign(Object.assign({},e),{basePath:e.basePath||s});if("string"==typeof e.accessToken&&e.accessToken){const t=e.accessToken,n=t.startsWith("Bearer ")?t.slice(7):t;this.configuration.apiKey=e=>r(this,void 0,void 0,(function*(){return"authorization"===(null==e?void 0:e.toLowerCase())?`Bearer ${n}`:n})),this.configuration.accessToken=()=>r(this,void 0,void 0,(function*(){return n}))}e.headers||(this.configuration.headers={"Content-Type":"application/json"})}}set config(e){this.configuration=e}get basePath(){return null!=this.configuration.basePath?this.configuration.basePath:s}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||p}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const e=this.configuration.apiKey;if(e)return"function"==typeof e?e:()=>e}get accessToken(){const e=this.configuration.accessToken;if(e)return"function"==typeof e?e:()=>r(this,void 0,void 0,(function*(){return e}))}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const d=new a;class u{constructor(e=d){this.configuration=e,this.fetchApi=(e,t)=>r(this,void 0,void 0,(function*(){let n,i={url:e,init:t};this.middleware&&Array.isArray(this.middleware)||(this.middleware=[]);for(const e of this.middleware)e.pre&&(i=(yield e.pre(Object.assign({fetch:this.fetchApi},i)))||i);try{n=yield(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(e){for(const t of this.middleware)t.onError&&(n=(yield t.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:e,response:n?n.clone():void 0}))||n);if(void 0===n)throw e instanceof Error?new c(e,"The request failed and the interceptors did not return an alternative response"):e}for(const e of this.middleware)e.post&&(n=(yield e.post({fetch:this.fetchApi,url:i.url,init:i.init,response:n.clone()}))||n);return n})),"string"!=typeof e&&(!e||e instanceof a)||(e=new a(e)),this.configuration=e,this.middleware=this.configuration.middleware||[]}withMiddleware(...e){const t=this.clone();return t.middleware=t.middleware.concat(...e),t}withPreMiddleware(...e){const t=e.map((e=>({pre:e})));return this.withMiddleware(...t)}withPostMiddleware(...e){const t=e.map((e=>({post:e})));return this.withMiddleware(...t)}isJsonMime(e){return!!e&&u.jsonRegex.test(e)}request(e,t){return r(this,void 0,void 0,(function*(){var n;const{url:i,init:o}=yield this.createFetchParams(e,t),r=new Headers(Object.assign(Object.assign(Object.assign({},this.configuration.headers),e.headers||{}),o.headers||{})),s=Object.assign(Object.assign({},o),{headers:r}),a=yield this.fetchApi(i,s);if(a&&a.status>=200&&a.status<300)return a;const d=a.clone();let u="Response returned an error code",c=null;try{const e=yield d.json(),t=e.error,i=t&&"object"==typeof t?t.message:t;u=e.message||i||u;const o=null===(n=null==e?void 0:e.error)||void 0===n?void 0:n.code;"string"==typeof o&&o.length>0&&(c=o)}catch(e){try{u=yield d.text()}catch(e){u=a.statusText}}throw new l(a,u,c)}))}createFetchParams(e,t){return r(this,void 0,void 0,(function*(){let n=(this.configuration.basePath||s).replace(/\/+$/,"")+(e.path.startsWith("/")?e.path:`/${e.path}`);void 0!==e.query&&0!==Object.keys(e.query).length&&(n+="?"+this.configuration.queryParamsStringify(e.query));const i=Object.assign({},this.configuration.headers,e.headers);Object.keys(i).forEach((e=>void 0===i[e]?delete i[e]:{}));const o=this.configuration.apiKey;if(o&&!i.Authorization)try{const e=yield o("Authorization");e&&(i.Authorization=e.startsWith("Bearer ")?e:`Bearer ${e}`)}catch(e){}const a="function"==typeof t?t:()=>r(this,void 0,void 0,(function*(){return t})),d={method:e.method,headers:i,body:e.body,credentials:this.configuration.credentials},u=Object.assign(Object.assign({},d),yield a({init:d,context:e}));let l;var c;c=u.body,l="undefined"!=typeof FormData&&c instanceof FormData||u.body instanceof URLSearchParams||function(e){return"undefined"!=typeof Blob&&e instanceof Blob}(u.body)?u.body:this.isJsonMime(i["Content-Type"])?JSON.stringify(u.body):u.body;return{url:n,init:Object.assign(Object.assign({},u),{body:l})}}))}clone(){const e=new(0,this.constructor)(this.configuration);return e.middleware=this.middleware.slice(),e}}u.jsonRegex=new RegExp("^(:?application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$","i");class l extends Error{constructor(e,t,n=null){super(t),this.response=e,this.name="ResponseError",this.code=n}}class c extends Error{constructor(e,t){super(t),this.cause=e,this.name="FetchError"}}class h extends Error{constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}function p(e,t=""){return Object.keys(e).map((n=>f(n,e[n],t))).filter((e=>e.length>0)).join("&")}function f(e,t,n=""){const i=n+(n.length?`[${e}]`:e);if(t instanceof Array){const e=t.map((e=>encodeURIComponent(String(e)))).join(`&${encodeURIComponent(i)}=`);return`${encodeURIComponent(i)}=${e}`}if(t instanceof Set){return f(e,Array.from(t),n)}return t instanceof Date?`${encodeURIComponent(i)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?p(t,i):`${encodeURIComponent(i)}=${encodeURIComponent(String(t))}`}function m(e,t){return Object.keys(e).reduce(((n,i)=>Object.assign(Object.assign({},n),{[i]:t(e[i])})),{})}class g{constructor(e,t=e=>e){this.raw=e,this.transformer=t}unwrapSuccessEnvelope(e){if(e&&"object"==typeof e&&"success"in e&&"data"in e){const{success:t,data:n,meta:i}=e,o="boolean"!=typeof t||t;return Array.isArray(n)?{success:o,data:n,meta:i,rawData:n}:n&&"object"==typeof n?Object.assign({success:o,data:n,meta:i},n):{success:o,data:n,meta:i}}return e}value(){return r(this,void 0,void 0,(function*(){const e=yield this.raw.json();return this.transformer(this.unwrapSuccessEnvelope(e))}))}}class v{constructor(e){this.raw=e}value(){return r(this,void 0,void 0,(function*(){}))}}function w(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,abTestId:null==e.abTestId?void 0:e.abTestId,compositionId:null==e.compositionId?void 0:e.compositionId,name:null==e.name?void 0:e.name,description:null==e.description?void 0:e.description,trafficPercentage:null==e.trafficPercentage?void 0:e.trafficPercentage,embedCode:null==e.embedCode?void 0:e.embedCode,totalImpressions:null==e.totalImpressions?void 0:e.totalImpressions,totalConversions:null==e.totalConversions?void 0:e.totalConversions,conversionRate:null==e.conversionRate?void 0:e.conversionRate,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt)}}(e)}function y(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,creatorId:null==e.creatorId?void 0:e.creatorId,organizationId:null==e.organizationId?void 0:e.organizationId,workspaceType:null==e.workspaceType?void 0:e.workspaceType,name:null==e.name?void 0:e.name,description:null==e.description?void 0:e.description,status:null==e.status?void 0:e.status,successMetrics:null==e.successMetrics?void 0:e.successMetrics,primaryMetric:null==e.primaryMetric?void 0:e.primaryMetric,confidenceLevel:null==e.confidenceLevel?void 0:e.confidenceLevel,minSampleSize:null==e.minSampleSize?void 0:e.minSampleSize,autoGraduate:null==e.autoGraduate?void 0:e.autoGraduate,graduationThreshold:null==e.graduationThreshold?void 0:e.graduationThreshold,startDate:null==e.startDate?void 0:new Date(e.startDate),endDate:null==e.endDate?void 0:new Date(e.endDate),durationDays:null==e.durationDays?void 0:e.durationDays,winningVariantId:null==e.winningVariantId?void 0:e.winningVariantId,graduatedAt:null==e.graduatedAt?void 0:new Date(e.graduatedAt),statisticalSignificance:null==e.statisticalSignificance?void 0:e.statisticalSignificance,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt),variants:null==e.variants?void 0:e.variants.map(w)}}(e)}function I(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,ab_test_id:null==e.ab_test_id?void 0:e.ab_test_id,variant_id:null==e.variant_id?void 0:e.variant_id,user_id:null==e.user_id?void 0:e.user_id,session_id:null==e.session_id?void 0:e.session_id,user_identifier_hash:null==e.user_identifier_hash?void 0:e.user_identifier_hash,assigned_at:null==e.assigned_at?void 0:new Date(e.assigned_at)}}(e)}function R(e){return function(e){if(null==e)return e;return{hasMeaningfulContrast:null==e.hasMeaningfulContrast?void 0:e.hasMeaningfulContrast,primaryDriver:null==e.primaryDriver?void 0:e.primaryDriver,cognitiveClarityScore:null==e.cognitiveClarityScore?void 0:e.cognitiveClarityScore,safeToGraduate:null==e.safeToGraduate?void 0:e.safeToGraduate,qualitativeReason:null==e.qualitativeReason?void 0:e.qualitativeReason}}(e)}function T(e){return function(e){if(null==e)return e;return{action:null==e.action?void 0:e.action,reason:null==e.reason?void 0:e.reason,minAdditionalSamples:null==e.minAdditionalSamples?void 0:e.minAdditionalSamples}}(e)}function q(e){return function(e){if(null==e)return e;return{totalImpressions:null==e.totalImpressions?void 0:e.totalImpressions,totalConversions:null==e.totalConversions?void 0:e.totalConversions,overallConversionRate:null==e.overallConversionRate?void 0:e.overallConversionRate,statisticalPower:null==e.statisticalPower?void 0:e.statisticalPower,confidenceLevel:null==e.confidenceLevel?void 0:e.confidenceLevel}}(e)}function C(e){return function(e){if(null==e)return e;return{variantId:null==e.variantId?void 0:e.variantId,variantName:null==e.variantName?void 0:e.variantName,impressions:null==e.impressions?void 0:e.impressions,conversions:null==e.conversions?void 0:e.conversions,conversionRate:null==e.conversionRate?void 0:e.conversionRate,confidenceIntervalLower:null==e.confidenceIntervalLower?void 0:e.confidenceIntervalLower,confidenceIntervalUpper:null==e.confidenceIntervalUpper?void 0:e.confidenceIntervalUpper,zScore:null==e.zScore?void 0:e.zScore,pValue:null==e.pValue?void 0:e.pValue,isWinner:null==e.isWinner?void 0:e.isWinner,liftPercentage:null==e.liftPercentage?void 0:e.liftPercentage,statisticalSignificance:null==e.statisticalSignificance?void 0:e.statisticalSignificance,bayesianProbabilityToBeatControl:null==e.bayesianProbabilityToBeatControl?void 0:e.bayesianProbabilityToBeatControl}}(e)}function k(e){return function(e){if(null==e)return e;return{overall:null==e.overall?void 0:q(e.overall),variants:null==e.variants?void 0:e.variants.map(C),recommendation:null==e.recommendation?void 0:T(e.recommendation)}}(e)}function A(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,translationId:null==e.translationId?void 0:e.translationId,compositionId:null==e.compositionId?void 0:e.compositionId,languageCode:null==e.languageCode?void 0:e.languageCode,languageName:null==e.languageName?void 0:e.languageName,isRoot:null==e.isRoot?void 0:e.isRoot,embedCode:null==e.embedCode?void 0:e.embedCode,totalViews:null==e.totalViews?void 0:e.totalViews,status:null==e.status?void 0:e.status,translationProgress:null==e.translationProgress?void 0:e.translationProgress,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt)}}(e)}function b(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,creatorId:null==e.creatorId?void 0:e.creatorId,name:null==e.name?void 0:e.name,description:null==e.description?void 0:e.description,rootCompositionId:null==e.rootCompositionId?void 0:e.rootCompositionId,rootLanguage:null==e.rootLanguage?void 0:e.rootLanguage,status:null==e.status?void 0:e.status,embedCode:null==e.embedCode?void 0:e.embedCode,selectedLanguages:null==e.selectedLanguages?void 0:e.selectedLanguages,totalViews:null==e.totalViews?void 0:e.totalViews,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt),variants:null==e.variants?void 0:e.variants.map(A)}}(e)}function S(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:b(e.data),message:null==e.message?void 0:e.message}}(e)}function B(e){return function(e){if(null==e)return e;return{id:e.id,composition_id:e.composition_id,date:new Date(e.date),country:e.country,region:null==e.region?void 0:e.region,city:null==e.city?void 0:e.city,views:e.views,unique_users:e.unique_users,created_at:null==e.created_at?void 0:new Date(e.created_at),updated_at:null==e.updated_at?void 0:new Date(e.updated_at)}}(e)}function E(e){return function(e){if(null==e)return e;return{total_views:null==e.total_views?void 0:e.total_views,unique_views:null==e.unique_views?void 0:e.unique_views,total_interactions:null==e.total_interactions?void 0:e.total_interactions,unique_interactions:null==e.unique_interactions?void 0:e.unique_interactions,average_session_time:null==e.average_session_time?void 0:e.average_session_time,bounce_rate:null==e.bounce_rate?void 0:e.bounce_rate}}(e)}function _(e){return function(e){if(null==e)return e;return{id:e.id,compositionId:e.compositionId,date:new Date(e.date),deviceType:e.deviceType,views:e.views,uniqueUsers:e.uniqueUsers,avgSessionDuration:e.avgSessionDuration,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt)}}(e)}function D(e){return function(e){if(null==e)return e;return{id:e.id,composition_id:e.composition_id,timestamp:new Date(e.timestamp),event_type:e.event_type,event_data:null==e.event_data?void 0:e.event_data,user_id:null==e.user_id?void 0:e.user_id,session_id:null==e.session_id?void 0:e.session_id,ip_address:null==e.ip_address?void 0:e.ip_address,user_agent:null==e.user_agent?void 0:e.user_agent,referrer:null==e.referrer?void 0:e.referrer,created_at:null==e.created_at?void 0:new Date(e.created_at)}}(e)}function U(e){return function(e){if(null==e)return e;return{id:e.id,composition_id:e.composition_id,date:new Date(e.date),source:e.source,source_url:null==e.source_url?void 0:e.source_url,views:e.views,unique_users:e.unique_users,created_at:null==e.created_at?void 0:new Date(e.created_at),updated_at:null==e.updated_at?void 0:new Date(e.updated_at)}}(e)}function P(e){return function(e){if(null==e)return e;return{summary:E(e.summary),devices:e.devices.map(_),geography:e.geography.map(B),referrers:e.referrers.map(U),events:null==e.events?void 0:e.events.map(D)}}(e)}function W(e){return function(e){if(null==e)return e;return{composition_id:e.composition_id,event_type:e.event_type,event_data:e.event_data,user_id:e.user_id,session_id:e.session_id,ip_address:e.ip_address,user_agent:e.user_agent,referrer:e.referrer}}(e,!1)}function K(e){return function(e){if(null==e)return e;return{events:e.events.map(W)}}(e,!1)}function z(e){return function(e){if(null==e)return e;return{canAccess:null==e.canAccess?void 0:e.canAccess,reason:null==e.reason?void 0:e.reason}}(e)}function O(e){return function(e){if(null==e)return e;return{canAccess:null==e.canAccess?void 0:e.canAccess,reason:null==e.reason?void 0:e.reason}}(e)}function x(e){return function(e){if(null==e)return e;return{should_stop:null==e.should_stop?void 0:e.should_stop,reason:null==e.reason?void 0:e.reason,new_status:null==e.new_status?void 0:e.new_status}}(e)}function j(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:x(e.data)}}(e)}function $(e){return function(e){if(null==e)return e;return{id:e.id,creatorId:e.creatorId,widgetId:e.widgetId,name:e.name,content:e.content,contentVersion:null==e.contentVersion?void 0:e.contentVersion,status:e.status,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt),embedSettings:null==e.embedSettings?void 0:e.embedSettings,design:null==e.design?void 0:e.design,databaseId:null==e.databaseId?void 0:e.databaseId,projectId:null==e.projectId?void 0:e.projectId,managedUserId:null==e.managedUserId?void 0:e.managedUserId,direct:null==e.direct?void 0:e.direct}}(e)}function G(e){return function(e){if(null==e)return e;return{url:e.url,refreshSeconds:e.refreshSeconds}}(e)}function L(e){return function(e){if(null==e)return e;return{name:e.name,type:e.type}}(e)}function M(e){return function(e){if(null==e)return e;return{name:e.name,columns:e.columns.map(L),rows:e.rows}}(e)}function V(e){return function(e){if(null==e)return e;return{compositionId:e.compositionId,hasData:e.hasData,tables:e.tables.map(M)}}(e)}function N(e){return function(e){if(null==e)return e;return{value:e.value,count:e.count}}(e)}function F(e){return function(e){if(null==e)return e;return{group:null==e.group?void 0:e.group,count:null==e.count?void 0:e.count,avg:null==e.avg?void 0:e.avg,min:null==e.min?void 0:e.min,max:null==e.max?void 0:e.max,sum:null==e.sum?void 0:e.sum}}(e)}function H(e){return function(e){if(null==e)return e;return{column:e.column,tallies:e.tallies.map(F),truncated:null==e.truncated?void 0:e.truncated}}(e)}function J(e){return function(e){if(null==e)return e;return{compositionId:e.compositionId,table:e.table,totalRows:e.totalRows,tallies:null==e.tallies?null:e.tallies.map(N),moreGroups:e.moreGroups,columns:e.columns,rows:null==e.rows?null:e.rows,moreRows:e.moreRows,aggregates:null==e.aggregates?void 0:H(e.aggregates)}}(e)}function Z(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,compositionId:null==e.compositionId?void 0:e.compositionId,version:null==e.version?void 0:e.version,content:null==e.content?void 0:e.content,createdAt:null==e.createdAt?void 0:new Date(e.createdAt)}}(e)}function Q(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:I(e.data)}}(e)}function X(e){return function(e){if(null==e)return e;return{name:e.name,description:e.description,compositionId:e.compositionId,trafficPercentage:e.trafficPercentage}}(e,!1)}function Y(e){return function(e){if(null==e)return e;return{name:e.name,description:e.description,status:e.status,workspaceType:e.workspaceType,variants:e.variants.map(X),successMetrics:e.successMetrics,primaryMetric:e.primaryMetric,confidenceLevel:e.confidenceLevel,minSampleSize:e.minSampleSize,autoGraduate:e.autoGraduate,graduationThreshold:e.graduationThreshold,startDate:null==e.startDate?void 0:e.startDate.toISOString(),endDate:null==e.endDate?void 0:e.endDate.toISOString(),durationDays:e.durationDays}}(e,!1)}function ee(e){return function(e){if(null==e)return e;return Object.assign(Object.assign({},e),{position:e.position})}(e,!1)}function te(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:$(e.data)}}(e)}function ne(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:b(e.data),message:null==e.message?void 0:e.message}}(e)}function ie(e){return function(e){if(null==e)return e;return{x:null==e.x?void 0:e.x,y:null==e.y?void 0:e.y}}(e)}function oe(e){return function(e){if(null==e)return e;return{width:null==e.width?void 0:e.width,height:null==e.height?void 0:e.height}}(e)}function re(e){return function(e){if(null==e)return e;return{componentId:null==e.componentId?void 0:e.componentId,path:null==e.path?void 0:e.path,planId:null==e.planId?void 0:e.planId,status:null==e.status?void 0:e.status,position:null==e.position?void 0:ie(e.position),size:null==e.size?void 0:oe(e.size)}}(e)}function se(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,name:null==e.name?void 0:e.name,creatorId:null==e.creatorId?void 0:e.creatorId,description:null==e.description?void 0:e.description,type:null==e.type?void 0:e.type,content:null==e.content?void 0:e.content,isPublic:null==e.isPublic?void 0:e.isPublic,isDraft:null==e.isDraft?void 0:e.isDraft,shareId:null==e.shareId?void 0:e.shareId,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt),jsPath:null==e.jsPath?void 0:e.jsPath,canvasId:null==e.canvasId?void 0:e.canvasId,repoId:null==e.repoId?void 0:e.repoId,databaseId:null==e.databaseId?void 0:e.databaseId,version:null==e.version?void 0:e.version,componentsMetadata:null==e.componentsMetadata?void 0:e.componentsMetadata.map(re),cpgSchemaId:null==e.cpgSchemaId?void 0:e.cpgSchemaId,lastCpgCommitSha:null==e.lastCpgCommitSha?void 0:e.lastCpgCommitSha,organizationId:null==e.organizationId?void 0:e.organizationId,projectFolder:null==e.projectFolder?void 0:e.projectFolder,workspaceType:null==e.workspaceType?void 0:e.workspaceType,managedUserId:null==e.managedUserId?void 0:e.managedUserId,warnings:null==e.warnings?void 0:e.warnings}}(e)}function ae(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:se(e.data),meta:null==e.meta?void 0:e.meta}}(e)}function de(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:y(e.data)}}(e)}function ue(e){return function(e){if(null==e)return e;return{id:e.id,compositionId:e.compositionId,date:new Date(e.date),totalViews:e.totalViews,uniqueViews:e.uniqueViews,totalInteractions:e.totalInteractions,uniqueInteractions:e.uniqueInteractions,totalSessionTime:e.totalSessionTime,averageSessionTime:e.averageSessionTime,bounceRate:e.bounceRate,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt)}}(e)}function le(e){return function(e){if(null==e)return e;return{deleted:null==e.deleted?void 0:e.deleted,contentVersion:null==e.contentVersion?void 0:e.contentVersion}}(e)}function ce(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,message:null==e.message?void 0:e.message}}(e)}function he(e){return function(e){if(null==e)return e;return{operationId:null==e.operationId?void 0:e.operationId}}(e)}function pe(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:he(e.data)}}(e)}function fe(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,name:null==e.name?void 0:e.name,creatorId:null==e.creatorId?void 0:e.creatorId,description:null==e.description?void 0:e.description,type:null==e.type?void 0:e.type,content:null==e.content?void 0:e.content,isPublic:null==e.isPublic?void 0:e.isPublic,isDraft:null==e.isDraft?void 0:e.isDraft,shareId:null==e.shareId?void 0:e.shareId,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt),jsPath:null==e.jsPath?void 0:e.jsPath,canvasId:null==e.canvasId?void 0:e.canvasId,repoId:null==e.repoId?void 0:e.repoId,databaseId:null==e.databaseId?void 0:e.databaseId,version:null==e.version?void 0:e.version,componentsMetadata:null==e.componentsMetadata?void 0:e.componentsMetadata.map(re),cpgSchemaId:null==e.cpgSchemaId?void 0:e.cpgSchemaId,lastCpgCommitSha:null==e.lastCpgCommitSha?void 0:e.lastCpgCommitSha,organizationId:null==e.organizationId?void 0:e.organizationId,projectFolder:null==e.projectFolder?void 0:e.projectFolder,workspaceType:null==e.workspaceType?void 0:e.workspaceType,managedUserId:null==e.managedUserId?void 0:e.managedUserId}}(e)}function me(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:fe(e.data),warnings:null==e.warnings?void 0:e.warnings}}(e)}function ge(e){return function(e){if(null==e)return e;return{token:null==e.token?void 0:e.token,tokenType:null==e.tokenType?void 0:e.tokenType,expiresIn:null==e.expiresIn?void 0:e.expiresIn,expiresAt:null==e.expiresAt?void 0:new Date(e.expiresAt),scopes:null==e.scopes?void 0:e.scopes}}(e)}function ve(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:ge(e.data)}}(e)}function we(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,name:null==e.name?void 0:e.name,composition_id:null==e.composition_id?void 0:e.composition_id,traffic_percentage:null==e.traffic_percentage?void 0:e.traffic_percentage}}(e)}function ye(e){return function(e){if(null==e)return e;return{test_id:null==e.test_id?void 0:e.test_id,name:null==e.name?void 0:e.name,status:null==e.status?void 0:e.status,variants:null==e.variants?void 0:e.variants.map(we),success_metrics:null==e.success_metrics?void 0:e.success_metrics}}(e)}function Ie(e){return function(e){if(null==e)return e;return{page:null==e.page?void 0:e.page,size:null==e.size?void 0:e.size,total:null==e.total?void 0:e.total}}(e)}function Re(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:e.data.map($),meta:null==e.meta?void 0:Ie(e.meta)}}(e)}function Te(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,name:null==e.name?void 0:e.name,description:null==e.description?void 0:e.description,category:null==e.category?void 0:e.category}}(e)}function qe(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:e.data.map(Te)}}(e)}function Ce(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,name:null==e.name?void 0:e.name,description:null==e.description?void 0:e.description}}(e)}function ke(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:e.data.map(Ce)}}(e)}function Ae(e){return function(e){if(null==e)return e;return{version:null==e.version?void 0:e.version,widgetType:null==e.widgetType?void 0:e.widgetType,type:null==e.type?void 0:e.type,content:null==e.content?void 0:e.content,contentItems:null==e.contentItems?void 0:e.contentItems,metadata:null==e.metadata?void 0:e.metadata}}(e)}function be(e){return function(e){if(null==e)return e;return{version:null==e.version?void 0:e.version,widgetType:null==e.widgetType?void 0:e.widgetType,type:null==e.type?void 0:e.type,theme:null==e.theme?void 0:e.theme,componentGroups:null==e.componentGroups?void 0:e.componentGroups,metadata:null==e.metadata?void 0:e.metadata}}(e)}function Se(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,name:null==e.name?void 0:e.name,version:null==e.version?void 0:e.version,type:null==e.type?void 0:e.type,componentGroups:null==e.componentGroups?void 0:e.componentGroups,defaults:null==e.defaults?void 0:e.defaults}}(e)}function Be(e){return function(e){if(null==e)return e;return{compositionId:null==e.compositionId?void 0:e.compositionId,widgetId:null==e.widgetId?void 0:e.widgetId,version:null==e.version?void 0:e.version,previewUrl:null==e.previewUrl?void 0:e.previewUrl}}(e)}function Ee(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:e.data.map(Z)}}(e)}function _e(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,error:null==e.error?void 0:e.error}}(e)}function De(e){return function(e){if(null==e)return e;return{compositions:null==e.compositions?void 0:e.compositions.map($),errors:null==e.errors?void 0:e.errors.map(_e)}}(e)}function Ue(e){return function(e){if(null==e)return e;return{presets:null==e.presets?void 0:e.presets}}(e)}function Pe(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:Ue(e.data)}}(e)}function We(e){return function(e){if(null==e)return e;return{name:null==e.name?void 0:e.name,nativeName:null==e.nativeName?void 0:e.nativeName,region:null==e.region?void 0:e.region,isPreselected:null==e.isPreselected?void 0:e.isPreselected}}(e)}function Ke(e){return function(e){if(null==e)return e;return{languages:null==e.languages?void 0:m(e.languages,We),preselected:null==e.preselected?void 0:e.preselected}}(e)}function ze(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:Ke(e.data)}}(e)}function Oe(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:b(e.data)}}(e)}function xe(e){return function(e){if(null==e)return e;return{languageCode:null==e.languageCode?void 0:e.languageCode,views:null==e.views?void 0:e.views,percentage:null==e.percentage?void 0:e.percentage}}(e)}function je(e){return function(e){if(null==e)return e;return{languageCode:null==e.languageCode?void 0:e.languageCode,views:null==e.views?void 0:e.views}}(e)}function $e(e){return function(e){if(null==e)return e;return{totalViews:null==e.totalViews?void 0:e.totalViews,languageBreakdown:null==e.languageBreakdown?void 0:e.languageBreakdown.map(xe),topPerformingLanguages:null==e.topPerformingLanguages?void 0:e.topPerformingLanguages.map(je),completionStatus:null==e.completionStatus?void 0:e.completionStatus}}(e)}function Ge(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:$e(e.data)}}(e)}function Le(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,name:null==e.name?void 0:e.name,rootLanguage:null==e.rootLanguage?void 0:e.rootLanguage,rootCompositionId:null==e.rootCompositionId?void 0:e.rootCompositionId,languageCompositions:null==e.languageCompositions?void 0:e.languageCompositions,status:null==e.status?void 0:e.status}}(e)}function Me(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:Le(e.data)}}(e)}function Ve(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:e.data.map(b),count:null==e.count?void 0:e.count}}(e)}function Ne(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,composition_id:null==e.composition_id?void 0:e.composition_id,name:null==e.name?void 0:e.name,traffic_percentage:null==e.traffic_percentage?void 0:e.traffic_percentage}}(e)}function Fe(e){return function(e){if(null==e)return e;return{id:null==e.id?void 0:e.id,version:null==e.version?void 0:e.version,commitSha:null==e.commitSha?void 0:e.commitSha,commitTitle:null==e.commitTitle?void 0:e.commitTitle,artifactUrl:null==e.artifactUrl?void 0:e.artifactUrl,publishedAt:null==e.publishedAt?void 0:new Date(e.publishedAt),isPublished:null==e.isPublished?void 0:e.isPublished,prompt:null==e.prompt?void 0:e.prompt,publishedBy:null==e.publishedBy?void 0:e.publishedBy}}(e)}function He(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:e.data.map(Fe)}}(e)}function Je(e){return function(e){if(null==e)return e;return{page:null==e.page?void 0:e.page,size:null==e.size?void 0:e.size,total:null==e.total?void 0:e.total,limit:null==e.limit?void 0:e.limit,offset:null==e.offset?void 0:e.offset,hasNextPage:null==e.hasNextPage?void 0:e.hasNextPage,hasPreviousPage:null==e.hasPreviousPage?void 0:e.hasPreviousPage}}(e)}function Ze(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:e.data.map(fe),meta:null==e.meta?void 0:Je(e.meta)}}(e)}function Qe(e){return function(e){if(null==e)return e;return{widgets:null==e.widgets?void 0:e.widgets.map(fe),errors:null==e.errors?void 0:e.errors.map(_e)}}(e)}function Xe(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:R(e.data)}}(e)}function Ye(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:k(e.data)}}(e)}function et(e){return function(e){if(null==e)return e;return{count:null==e.count?void 0:e.count,workspace_type:null==e.workspace_type?void 0:e.workspace_type}}(e)}function tt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:e.data.map(y),meta:null==e.meta?void 0:et(e.meta)}}(e)}function nt(e){return function(e){if(null==e)return e;return{id:e.id,compositionId:e.compositionId,year:e.year,month:e.month,startDate:new Date(e.startDate),endDate:new Date(e.endDate),totalViews:e.totalViews,uniqueViews:e.uniqueViews,totalInteractions:e.totalInteractions,uniqueInteractions:e.uniqueInteractions,totalSessionTime:e.totalSessionTime,averageSessionTime:e.averageSessionTime,bounceRate:e.bounceRate,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt)}}(e)}function it(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:e.data}}(e)}function ot(e){return function(e){if(null==e)return e;return{widgetId:null==e.widgetId?void 0:e.widgetId,version:null==e.version?void 0:e.version,commitTitle:null==e.commitTitle?void 0:e.commitTitle}}(e)}function rt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:ot(e.data)}}(e)}function st(e){return function(e){if(null==e)return e;return{email:e.email}}(e,!1)}function at(e){return function(e){if(null==e)return e;return{valid:null==e.valid?void 0:e.valid,errors:null==e.errors?void 0:e.errors,warnings:null==e.warnings?void 0:e.warnings}}(e)}function dt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,contentVersion:null==e.contentVersion?void 0:e.contentVersion,validationResult:null==e.validationResult?void 0:at(e.validationResult),compositionUpdated:null==e.compositionUpdated?void 0:e.compositionUpdated,realtimeUpdateSent:null==e.realtimeUpdateSent?void 0:e.realtimeUpdateSent}}(e)}function ut(e){return function(e){if(null==e)return e;return{widgetId:null==e.widgetId?void 0:e.widgetId,version:null==e.version?void 0:e.version,artifactUrl:null==e.artifactUrl?void 0:e.artifactUrl,commitSha:null==e.commitSha?void 0:e.commitSha,commitTitle:null==e.commitTitle?void 0:e.commitTitle}}(e)}function lt(e){return function(e){if(null==e)return e;return{data:null==e.data?void 0:ut(e.data),message:null==e.message?void 0:e.message}}(e)}function ct(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:lt(e.data)}}(e)}function ht(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:y(e.data),message:null==e.message?void 0:e.message}}(e)}function pt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:y(e.data),message:null==e.message?void 0:e.message}}(e)}function ft(e){return function(e){if(null==e)return e;return{limit:null==e.limit?void 0:e.limit,hasNextPage:null==e.hasNextPage?void 0:e.hasNextPage,hasPreviousPage:null==e.hasPreviousPage?void 0:e.hasPreviousPage,nextCursor:null==e.nextCursor?void 0:e.nextCursor,previousCursor:null==e.previousCursor?void 0:e.previousCursor}}(e)}function mt(e){return function(e){if(null==e)return e;return{pagination:null==e.pagination?void 0:ft(e.pagination)}}(e)}function gt(e){return function(e){if(null==e)return e;return{success:e.success,message:null==e.message?void 0:e.message,data:e.data,meta:null==e.meta?void 0:mt(e.meta)}}(e)}function vt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,message:null==e.message?void 0:e.message}}(e)}function wt(e){return function(e){if(null==e)return e;return{experiment_id:e.experiment_id,variant_id:e.variant_id,conversion_type:e.conversion_type,timestamp:null==e.timestamp?void 0:e.timestamp.toISOString(),user_id:e.user_id}}(e,!1)}function yt(e){return function(e){if(null==e)return e;return{event_type:e.event_type,data:wt(e.data)}}(e,!1)}function It(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,message:null==e.message?void 0:e.message,count:null==e.count?void 0:e.count}}(e)}function Rt(e){return function(e){if(null==e)return e;return{experiment_id:e.experiment_id,variant_id:e.variant_id,conversion_type:e.conversion_type,timestamp:null==e.timestamp?void 0:e.timestamp.toISOString()}}(e,!1)}function Tt(e){return function(e){if(null==e)return e;return{event_type:e.event_type,data:Rt(e.data)}}(e,!1)}function qt(e){return function(e){if(null==e)return e;return{events:e.events.map(Tt)}}(e,!1)}function Ct(e){return function(e){if(null==e)return e;return{name:e.name,description:e.description,status:e.status,successMetrics:e.successMetrics,primaryMetric:e.primaryMetric,confidenceLevel:e.confidenceLevel,minSampleSize:e.minSampleSize,autoGraduate:e.autoGraduate,graduationThreshold:e.graduationThreshold,startDate:null==e.startDate?void 0:e.startDate.toISOString(),endDate:null==e.endDate?void 0:e.endDate.toISOString(),durationDays:e.durationDays}}(e,!1)}function kt(e){return function(e){if(null==e)return e;return{token:e.token,email:e.email}}(e,!1)}function At(e){return function(e){if(null==e)return e;return{repositoryId:null==e.repositoryId?void 0:e.repositoryId}}(e)}function bt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:At(e.data),meta:null==e.meta?void 0:e.meta}}(e)}function St(e){return function(e){if(null==e)return e;return{thumbnailUrl:null==e.thumbnailUrl?void 0:e.thumbnailUrl}}(e)}function Bt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:St(e.data)}}(e)}function Et(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,message:null==e.message?void 0:e.message}}(e)}function _t(e){return function(e){if(null==e)return e;return{valid:null==e.valid?void 0:e.valid,errors:null==e.errors?void 0:e.errors,warnings:null==e.warnings?void 0:e.warnings,sanitizedContent:null==e.sanitizedContent?void 0:e.sanitizedContent}}(e)}function Dt(e){return function(e){if(null==e)return e;return{valid:null==e.valid?void 0:e.valid,reason:null==e.reason?void 0:e.reason,message:null==e.message?void 0:e.message}}(e)}function Ut(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:Dt(e.data)}}(e)}function Pt(e){return function(e){if(null==e)return e;return{valid:null==e.valid?void 0:e.valid,tokenType:null==e.tokenType?void 0:e.tokenType,scopes:null==e.scopes?void 0:e.scopes,userId:null==e.userId?void 0:e.userId,expiresAt:null==e.expiresAt?void 0:new Date(e.expiresAt)}}(e)}function Wt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:Pt(e.data)}}(e)}function Kt(e){return function(e){if(null==e)return e;return{test_id:null==e.test_id?void 0:e.test_id,test_name:null==e.test_name?void 0:e.test_name,status:null==e.status?void 0:e.status,impact:null==e.impact?void 0:e.impact}}(e)}function zt(e){return function(e){if(null==e)return e;return{test_id:null==e.test_id?void 0:e.test_id,test_name:null==e.test_name?void 0:e.test_name,status:null==e.status?void 0:e.status,reason:null==e.reason?void 0:e.reason}}(e)}function Ot(e){return function(e){if(null==e)return e;return{can_delete:null==e.can_delete?void 0:e.can_delete,blockers:null==e.blockers?void 0:e.blockers.map(zt),warnings:null==e.warnings?void 0:e.warnings.map(Kt)}}(e)}function xt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:Ot(e.data)}}(e)}function jt(e){return function(e){if(null==e)return e;return{variant:null==e.variant?void 0:e.variant,metric:null==e.metric?void 0:e.metric,reason:null==e.reason?void 0:e.reason}}(e)}function $t(e){return function(e){if(null==e)return e;return{is_valid:null==e.is_valid?void 0:e.is_valid,issues:null==e.issues?void 0:e.issues.map(jt),recommendations:null==e.recommendations?void 0:e.recommendations}}(e)}function Gt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:$t(e.data)}}(e)}function Lt(e){return function(e){if(null==e)return e;return{composition_id:e.composition_id,name:e.name}}(e,!1)}function Mt(e){return function(e){if(null==e)return e;return{variants:e.variants.map(Lt),success_metrics:e.success_metrics}}(e,!1)}function Vt(e){return function(e){if(null==e)return e;return{can_delete:null==e.can_delete?void 0:e.can_delete,affected_compositions:null==e.affected_compositions?void 0:e.affected_compositions,blockers:null==e.blockers?void 0:e.blockers.map(zt),warnings:null==e.warnings?void 0:e.warnings.map(Kt)}}(e)}function Nt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:Vt(e.data)}}(e)}function Ft(e){return function(e){if(null==e)return e;return{id:e.id,compositionId:e.compositionId,year:e.year,weekNumber:e.weekNumber,startDate:new Date(e.startDate),endDate:new Date(e.endDate),totalViews:e.totalViews,uniqueViews:e.uniqueViews,totalInteractions:e.totalInteractions,uniqueInteractions:e.uniqueInteractions,totalSessionTime:e.totalSessionTime,averageSessionTime:e.averageSessionTime,bounceRate:e.bounceRate,createdAt:null==e.createdAt?void 0:new Date(e.createdAt),updatedAt:null==e.updatedAt?void 0:new Date(e.updatedAt)}}(e)}var Ht="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))};class Jt extends u{assignVariantRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling assignVariant().');if(null==e.assignVariantRequest)throw new h("assignVariantRequest",'Required parameter "assignVariantRequest" was null or undefined when calling assignVariant().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/ab-tests/{id}/assign".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(r=e.assignVariantRequest,o=r,null==o?o:{user_id:o.user_id,session_id:o.session_id})},t);var o,r;return new g(i,(e=>w(e)))}))}assignVariant(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.assignVariantRaw(e,t);return yield n.value()}))}checkWorkspaceABTestAutoStopRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling checkWorkspaceABTestAutoStop().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling checkWorkspaceABTestAutoStop().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}/auto-stop-check".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>j(e)))}))}checkWorkspaceABTestAutoStop(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.checkWorkspaceABTestAutoStopRaw(e,t);return yield n.value()}))}createABTestAssignmentRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.createABTestAssignmentRequest)throw new h("createABTestAssignmentRequest",'Required parameter "createABTestAssignmentRequest" was null or undefined when calling createABTestAssignment().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/ab-tests/assignments",method:"POST",headers:n,query:{},body:(r=e.createABTestAssignmentRequest,o=r,null==o?o:{experiment_id:o.experiment_id,variant_id:o.variant_id,user_id:o.user_id,session_id:o.session_id,device_type:o.device_type,user_agent:o.user_agent,ip_address:o.ip_address,country_code:o.country_code})},t);var o,r;return new g(i,(e=>Q(e)))}))}createABTestAssignment(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.createABTestAssignmentRaw(e,t);return yield n.value()}))}createWorkspaceABTestRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling createWorkspaceABTest().');if(null==e.createABTestRequest)throw new h("createABTestRequest",'Required parameter "createABTestRequest" was null or undefined when calling createWorkspaceABTest().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))),method:"POST",headers:n,query:{},body:Y(e.createABTestRequest)},t);return new g(i,(e=>de(e)))}))}createWorkspaceABTest(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.createWorkspaceABTestRaw(e,t);return yield n.value()}))}deleteWorkspaceABTestRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling deleteWorkspaceABTest().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling deleteWorkspaceABTest().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"DELETE",headers:n,query:{}},t);return new g(i,(e=>ce(e)))}))}deleteWorkspaceABTest(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.deleteWorkspaceABTestRaw(e,t);return yield n.value()}))}getABTestConfigRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getABTestConfig().');const n=yield this.request({path:"/ab-tests/{id}/config".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:{}},t);return new g(n,(e=>ye(e)))}))}getABTestConfig(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.getABTestConfigRaw(e,t);return yield n.value()}))}getAvailableMetricsRaw(e){return Ht(this,void 0,void 0,(function*(){const t={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,n=yield e("apiKeyAuth",[]);n&&(t.Authorization=`Bearer ${n}`)}const n=yield this.request({path:"/metrics/available",method:"GET",headers:t,query:{}},e);return new g(n,(e=>qe(e)))}))}getAvailableMetrics(e){return Ht(this,void 0,void 0,(function*(){const t=yield this.getAvailableMetricsRaw(e);return yield t.value()}))}getAvailableSuccessMetricsRaw(e){return Ht(this,void 0,void 0,(function*(){const t={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,n=yield e("apiKeyAuth",[]);n&&(t.Authorization=`Bearer ${n}`)}const n=yield this.request({path:"/ab-tests/metrics/available",method:"GET",headers:t,query:{}},e);return new g(n,(e=>ke(e)))}))}getAvailableSuccessMetrics(e){return Ht(this,void 0,void 0,(function*(){const t=yield this.getAvailableSuccessMetricsRaw(e);return yield t.value()}))}getVariantConfigRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getVariantConfig().');const n=yield this.request({path:"/ab-tests/variants/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:{}},t);return new g(n,(e=>Ne(e)))}))}getVariantConfig(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.getVariantConfigRaw(e,t);return yield n.value()}))}getWorkspaceABTestRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling getWorkspaceABTest().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling getWorkspaceABTest().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>de(e)))}))}getWorkspaceABTest(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.getWorkspaceABTestRaw(e,t);return yield n.value()}))}getWorkspaceABTestDiagnosisRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling getWorkspaceABTestDiagnosis().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling getWorkspaceABTestDiagnosis().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}/diagnosis".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>Xe(e)))}))}getWorkspaceABTestDiagnosis(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.getWorkspaceABTestDiagnosisRaw(e,t);return yield n.value()}))}getWorkspaceABTestStatisticsRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling getWorkspaceABTestStatistics().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling getWorkspaceABTestStatistics().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}/statistics".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>Ye(e)))}))}getWorkspaceABTestStatistics(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.getWorkspaceABTestStatisticsRaw(e,t);return yield n.value()}))}listWorkspaceABTestsRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling listWorkspaceABTests().');const n={};null!=e.status&&(n.status=e.status);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/workspaces/{workspaceId}/ab-tests".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))),method:"GET",headers:i,query:n},t);return new g(o,(e=>tt(e)))}))}listWorkspaceABTests(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.listWorkspaceABTestsRaw(e,t);return yield n.value()}))}pauseWorkspaceABTestRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling pauseWorkspaceABTest().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling pauseWorkspaceABTest().');const n={};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}/pause".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"POST",headers:n,query:{}},t);return new g(i,(e=>de(e)))}))}pauseWorkspaceABTest(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.pauseWorkspaceABTestRaw(e,t);return yield n.value()}))}setWorkspaceABTestDurationRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling setWorkspaceABTestDuration().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling setWorkspaceABTestDuration().');if(null==e.setWorkspaceABTestDurationRequest)throw new h("setWorkspaceABTestDurationRequest",'Required parameter "setWorkspaceABTestDurationRequest" was null or undefined when calling setWorkspaceABTestDuration().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}/duration".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"PUT",headers:n,query:{},body:(r=e.setWorkspaceABTestDurationRequest,o=r,null==o?o:{duration_days:o.duration_days})},t);var o,r;return new g(i,(e=>ht(e)))}))}setWorkspaceABTestDuration(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.setWorkspaceABTestDurationRaw(e,t);return yield n.value()}))}startWorkspaceABTestRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling startWorkspaceABTest().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling startWorkspaceABTest().');const n={};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}/start".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"POST",headers:n,query:{}},t);return new g(i,(e=>de(e)))}))}startWorkspaceABTest(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.startWorkspaceABTestRaw(e,t);return yield n.value()}))}stopWorkspaceABTestRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling stopWorkspaceABTest().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling stopWorkspaceABTest().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}/stop".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"POST",headers:n,query:{},body:(r=e.stopWorkspaceABTestRequest,o=r,null==o?o:{winning_variant_id:o.winning_variant_id,winningVariantId:o.winningVariantId})},t);var o,r;return new g(i,(e=>pt(e)))}))}stopWorkspaceABTest(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.stopWorkspaceABTestRaw(e,t);return yield n.value()}))}trackABTestEventRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.trackABTestEventRequest)throw new h("trackABTestEventRequest",'Required parameter "trackABTestEventRequest" was null or undefined when calling trackABTestEvent().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/ab-tests/analytics/events",method:"POST",headers:n,query:{},body:yt(e.trackABTestEventRequest)},t);return new g(i,(e=>vt(e)))}))}trackABTestEvent(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.trackABTestEventRaw(e,t);return yield n.value()}))}trackBulkABTestEventsRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.trackBulkABTestEventsRequest)throw new h("trackBulkABTestEventsRequest",'Required parameter "trackBulkABTestEventsRequest" was null or undefined when calling trackBulkABTestEvents().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/ab-tests/analytics/bulk",method:"POST",headers:n,query:{},body:qt(e.trackBulkABTestEventsRequest)},t);return new g(i,(e=>It(e)))}))}trackBulkABTestEvents(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.trackBulkABTestEventsRaw(e,t);return yield n.value()}))}updateWorkspaceABTestRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling updateWorkspaceABTest().');if(null==e.testId)throw new h("testId",'Required parameter "testId" was null or undefined when calling updateWorkspaceABTest().');if(null==e.updateABTestRequest)throw new h("updateABTestRequest",'Required parameter "updateABTestRequest" was null or undefined when calling updateWorkspaceABTest().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/{testId}".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))).replace("{testId}",encodeURIComponent(String(e.testId))),method:"PUT",headers:n,query:{},body:Ct(e.updateABTestRequest)},t);return new g(i,(e=>de(e)))}))}updateWorkspaceABTest(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.updateWorkspaceABTestRaw(e,t);return yield n.value()}))}validateWorkspaceCompositionDeletionRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling validateWorkspaceCompositionDeletion().');if(null==e.validateWorkspaceCompositionDeletionRequest)throw new h("validateWorkspaceCompositionDeletionRequest",'Required parameter "validateWorkspaceCompositionDeletionRequest" was null or undefined when calling validateWorkspaceCompositionDeletion().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/validate-composition-deletion".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))),method:"POST",headers:n,query:{},body:(r=e.validateWorkspaceCompositionDeletionRequest,o=r,null==o?o:{composition_ids:o.composition_ids})},t);var o,r;return new g(i,(e=>xt(e)))}))}validateWorkspaceCompositionDeletion(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.validateWorkspaceCompositionDeletionRaw(e,t);return yield n.value()}))}validateWorkspaceGoalTrackingRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling validateWorkspaceGoalTracking().');if(null==e.validateWorkspaceGoalTrackingRequest)throw new h("validateWorkspaceGoalTrackingRequest",'Required parameter "validateWorkspaceGoalTrackingRequest" was null or undefined when calling validateWorkspaceGoalTracking().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/validate-goal-tracking".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))),method:"POST",headers:n,query:{},body:Mt(e.validateWorkspaceGoalTrackingRequest)},t);return new g(i,(e=>Gt(e)))}))}validateWorkspaceGoalTracking(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.validateWorkspaceGoalTrackingRaw(e,t);return yield n.value()}))}validateWorkspaceWidgetDeletionRaw(e,t){return Ht(this,void 0,void 0,(function*(){if(null==e.workspaceId)throw new h("workspaceId",'Required parameter "workspaceId" was null or undefined when calling validateWorkspaceWidgetDeletion().');if(null==e.validateWorkspaceWidgetDeletionRequest)throw new h("validateWorkspaceWidgetDeletionRequest",'Required parameter "validateWorkspaceWidgetDeletionRequest" was null or undefined when calling validateWorkspaceWidgetDeletion().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/workspaces/{workspaceId}/ab-tests/validate-widget-deletion".replace("{workspaceId}",encodeURIComponent(String(e.workspaceId))),method:"POST",headers:n,query:{},body:(r=e.validateWorkspaceWidgetDeletionRequest,o=r,null==o?o:{widget_id:o.widget_id})},t);var o,r;return new g(i,(e=>Nt(e)))}))}validateWorkspaceWidgetDeletion(e,t){return Ht(this,void 0,void 0,(function*(){const n=yield this.validateWorkspaceWidgetDeletionRaw(e,t);return yield n.value()}))}}var Zt="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))};class Qt extends u{analyticsEventsBulkPostRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.analyticsEventsBulkPostRequest)throw new h("analyticsEventsBulkPostRequest",'Required parameter "analyticsEventsBulkPostRequest" was null or undefined when calling analyticsEventsBulkPost().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/analytics/events/bulk",method:"POST",headers:n,query:{},body:K(e.analyticsEventsBulkPostRequest)},t);return new g(i,(e=>e.map(D)))}))}analyticsEventsBulkPost(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.analyticsEventsBulkPostRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsDailyGetRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling compositionsIdAnalyticsDailyGet().');const n={};null!=e.startDate&&(n.start_date=e.startDate.toISOString().substring(0,10)),null!=e.endDate&&(n.end_date=e.endDate.toISOString().substring(0,10)),null!=e.limit&&(n.limit=e.limit),null!=e.offset&&(n.offset=e.offset);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions/{id}/analytics/daily".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:i,query:n},t);return new g(o,(e=>e.map(ue)))}))}compositionsIdAnalyticsDailyGet(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsDailyGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsDashboardGetRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling compositionsIdAnalyticsDashboardGet().');const n={};null!=e.startDate&&(n.start_date=e.startDate.toISOString().substring(0,10)),null!=e.endDate&&(n.end_date=e.endDate.toISOString().substring(0,10)),null!=e.includeEvents&&(n.include_events=e.includeEvents);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions/{id}/analytics/dashboard".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:i,query:n},t);return new g(o,(e=>P(e)))}))}compositionsIdAnalyticsDashboardGet(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsDashboardGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsDevicesGetRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling compositionsIdAnalyticsDevicesGet().');const n={};null!=e.startDate&&(n.start_date=e.startDate.toISOString().substring(0,10)),null!=e.endDate&&(n.end_date=e.endDate.toISOString().substring(0,10)),null!=e.deviceType&&(n.device_type=e.deviceType),null!=e.limit&&(n.limit=e.limit),null!=e.offset&&(n.offset=e.offset);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions/{id}/analytics/devices".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:i,query:n},t);return new g(o,(e=>e.map(_)))}))}compositionsIdAnalyticsDevicesGet(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsDevicesGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsEventsGetRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling compositionsIdAnalyticsEventsGet().');const n={};null!=e.startDate&&(n.start_date=e.startDate.toISOString().substring(0,10)),null!=e.endDate&&(n.end_date=e.endDate.toISOString().substring(0,10)),null!=e.eventType&&(n.event_type=e.eventType),null!=e.userId&&(n.user_id=e.userId),null!=e.sessionId&&(n.session_id=e.sessionId),null!=e.limit&&(n.limit=e.limit),null!=e.offset&&(n.offset=e.offset);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions/{id}/analytics/events".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:i,query:n},t);return new g(o,(e=>e.map(D)))}))}compositionsIdAnalyticsEventsGet(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsEventsGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsEventsPostRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling compositionsIdAnalyticsEventsPost().');if(null==e.newAnalyticsEvent)throw new h("newAnalyticsEvent",'Required parameter "newAnalyticsEvent" was null or undefined when calling compositionsIdAnalyticsEventsPost().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/analytics/events".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:W(e.newAnalyticsEvent)},t);return new g(i,(e=>D(e)))}))}compositionsIdAnalyticsEventsPost(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsEventsPostRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsGeographyGetRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling compositionsIdAnalyticsGeographyGet().');const n={};null!=e.startDate&&(n.start_date=e.startDate.toISOString().substring(0,10)),null!=e.endDate&&(n.end_date=e.endDate.toISOString().substring(0,10)),null!=e.country&&(n.country=e.country),null!=e.region&&(n.region=e.region),null!=e.city&&(n.city=e.city),null!=e.limit&&(n.limit=e.limit),null!=e.offset&&(n.offset=e.offset);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions/{id}/analytics/geography".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:i,query:n},t);return new g(o,(e=>e.map(B)))}))}compositionsIdAnalyticsGeographyGet(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsGeographyGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsMonthlyGetRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling compositionsIdAnalyticsMonthlyGet().');const n={};null!=e.month&&(n.month=e.month),null!=e.year&&(n.year=e.year),null!=e.limit&&(n.limit=e.limit),null!=e.offset&&(n.offset=e.offset);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions/{id}/analytics/monthly".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:i,query:n},t);return new g(o,(e=>e.map(nt)))}))}compositionsIdAnalyticsMonthlyGet(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsMonthlyGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsReferrersGetRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling compositionsIdAnalyticsReferrersGet().');const n={};null!=e.startDate&&(n.start_date=e.startDate.toISOString().substring(0,10)),null!=e.endDate&&(n.end_date=e.endDate.toISOString().substring(0,10)),null!=e.source&&(n.source=e.source),null!=e.limit&&(n.limit=e.limit),null!=e.offset&&(n.offset=e.offset);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions/{id}/analytics/referrers".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:i,query:n},t);return new g(o,(e=>e.map(U)))}))}compositionsIdAnalyticsReferrersGet(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsReferrersGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsWeeklyGetRaw(e,t){return Zt(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling compositionsIdAnalyticsWeeklyGet().');const n={};null!=e.weekNumber&&(n.week_number=e.weekNumber),null!=e.year&&(n.year=e.year),null!=e.limit&&(n.limit=e.limit),null!=e.offset&&(n.offset=e.offset);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions/{id}/analytics/weekly".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:i,query:n},t);return new g(o,(e=>e.map(Ft)))}))}compositionsIdAnalyticsWeeklyGet(e,t){return Zt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsWeeklyGetRaw(e,t);return yield n.value()}))}flushAxiomEventsRaw(e){return Zt(this,void 0,void 0,(function*(){const t={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,n=yield e("bearerAuth",[]);n&&(t.Authorization=`Bearer ${n}`)}const n=yield this.request({path:"/analytics/axiom/flush",method:"POST",headers:t,query:{}},e);return new g(n,(e=>gt(e)))}))}flushAxiomEvents(e){return Zt(this,void 0,void 0,(function*(){const t=yield this.flushAxiomEventsRaw(e);return yield t.value()}))}getAxiomStatusRaw(e){return Zt(this,void 0,void 0,(function*(){const t={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,n=yield e("bearerAuth",[]);n&&(t.Authorization=`Bearer ${n}`)}const n=yield this.request({path:"/analytics/axiom/status",method:"GET",headers:t,query:{}},e);return new g(n,(e=>gt(e)))}))}getAxiomStatus(e){return Zt(this,void 0,void 0,(function*(){const t=yield this.getAxiomStatusRaw(e);return yield t.value()}))}}var Xt="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))};class Yt extends u{completeSignupRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.completeSignupRequest)throw new h("completeSignupRequest",'Required parameter "completeSignupRequest" was null or undefined when calling completeSignup().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/auth/complete-signup",method:"POST",headers:n,query:{},body:(r=e.completeSignupRequest,o=r,null==o?o:{userId:o.userId,email:o.email,role:o.role,plan:o.plan,token:o.token})},t);var o,r;return new v(i)}))}completeSignup(e,t){return Xt(this,void 0,void 0,(function*(){yield this.completeSignupRaw(e,t)}))}confirmEmailRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.updateEmailRequest)throw new h("updateEmailRequest",'Required parameter "updateEmailRequest" was null or undefined when calling confirmEmail().');const n={"Content-Type":"application/json"},i=yield this.request({path:"/auth/confirm-email",method:"POST",headers:n,query:{},body:kt(e.updateEmailRequest)},t);return new v(i)}))}confirmEmail(e,t){return Xt(this,void 0,void 0,(function*(){yield this.confirmEmailRaw(e,t)}))}consumeOAuthSessionBridgeRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.bridgeId)throw new h("bridgeId",'Required parameter "bridgeId" was null or undefined when calling consumeOAuthSessionBridge().');const n=yield this.request({path:"/auth/oauth-session/{bridgeId}".replace("{bridgeId}",encodeURIComponent(String(e.bridgeId))),method:"GET",headers:{},query:{}},t);return new v(n)}))}consumeOAuthSessionBridge(e,t){return Xt(this,void 0,void 0,(function*(){yield this.consumeOAuthSessionBridgeRaw(e,t)}))}deleteAccountRaw(e,t){return Xt(this,void 0,void 0,(function*(){const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/auth/delete-account",method:"POST",headers:n,query:{},body:(r=e.deleteAccountRequest,o=r,null==o?o:{password:o.password})},t);var o,r;return new v(i)}))}deleteAccount(){return Xt(this,arguments,void 0,(function*(e={},t){yield this.deleteAccountRaw(e,t)}))}getSessionRaw(e){return Xt(this,void 0,void 0,(function*(){const t={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,n=yield e("apiKeyAuth",[]);n&&(t.Authorization=`Bearer ${n}`)}const n=yield this.request({path:"/auth/session",method:"GET",headers:t,query:{}},e);return new v(n)}))}getSession(e){return Xt(this,void 0,void 0,(function*(){yield this.getSessionRaw(e)}))}getUserMetadataRaw(e){return Xt(this,void 0,void 0,(function*(){const t={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,n=yield e("apiKeyAuth",[]);n&&(t.Authorization=`Bearer ${n}`)}const n=yield this.request({path:"/auth/get-metadata",method:"GET",headers:t,query:{}},e);return new v(n)}))}getUserMetadata(e){return Xt(this,void 0,void 0,(function*(){yield this.getUserMetadataRaw(e)}))}initiateOAuthRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.provider)throw new h("provider",'Required parameter "provider" was null or undefined when calling initiateOAuth().');const n={};null!=e.redirectTo&&(n.redirectTo=e.redirectTo),null!=e.role&&(n.role=e.role),null!=e.plan&&(n.plan=e.plan);const i=yield this.request({path:"/auth/oauth/{provider}".replace("{provider}",encodeURIComponent(String(e.provider))),method:"GET",headers:{},query:n},t);return new v(i)}))}initiateOAuth(e,t){return Xt(this,void 0,void 0,(function*(){yield this.initiateOAuthRaw(e,t)}))}loginUserRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.loginUserRequest)throw new h("loginUserRequest",'Required parameter "loginUserRequest" was null or undefined when calling loginUser().');const n={"Content-Type":"application/json"},i=yield this.request({path:"/auth/login",method:"POST",headers:n,query:{},body:(r=e.loginUserRequest,o=r,null==o?o:{email:o.email,password:o.password})},t);var o,r;return new g(i,(e=>it(e)))}))}loginUser(e,t){return Xt(this,void 0,void 0,(function*(){const n=yield this.loginUserRaw(e,t);return yield n.value()}))}logoutUserRaw(e){return Xt(this,void 0,void 0,(function*(){const t={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,n=yield e("apiKeyAuth",[]);n&&(t.Authorization=`Bearer ${n}`)}const n=yield this.request({path:"/auth/logout",method:"POST",headers:t,query:{}},e);return new v(n)}))}logoutUser(e){return Xt(this,void 0,void 0,(function*(){yield this.logoutUserRaw(e)}))}refreshSessionRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.refreshSessionRequest)throw new h("refreshSessionRequest",'Required parameter "refreshSessionRequest" was null or undefined when calling refreshSession().');const n={"Content-Type":"application/json"},i=yield this.request({path:"/auth/refresh",method:"POST",headers:n,query:{},body:(r=e.refreshSessionRequest,o=r,null==o?o:{refresh_token:o.refresh_token})},t);var o,r;return new v(i)}))}refreshSession(e,t){return Xt(this,void 0,void 0,(function*(){yield this.refreshSessionRaw(e,t)}))}resendConfirmationRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.resetPasswordRequest)throw new h("resetPasswordRequest",'Required parameter "resetPasswordRequest" was null or undefined when calling resendConfirmation().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/auth/resend-confirmation",method:"POST",headers:n,query:{},body:st(e.resetPasswordRequest)},t);return new v(i)}))}resendConfirmation(e,t){return Xt(this,void 0,void 0,(function*(){yield this.resendConfirmationRaw(e,t)}))}resetPasswordRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.resetPasswordRequest)throw new h("resetPasswordRequest",'Required parameter "resetPasswordRequest" was null or undefined when calling resetPassword().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/auth/reset-password",method:"POST",headers:n,query:{},body:st(e.resetPasswordRequest)},t);return new v(i)}))}resetPassword(e,t){return Xt(this,void 0,void 0,(function*(){yield this.resetPasswordRaw(e,t)}))}signupUserRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.signupUserRequest)throw new h("signupUserRequest",'Required parameter "signupUserRequest" was null or undefined when calling signupUser().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/auth/signup",method:"POST",headers:n,query:{},body:(r=e.signupUserRequest,o=r,null==o?o:{email:o.email,password:o.password,role:o.role,plan:o.plan,inviteCode:o.inviteCode,name:o.name,returnTo:o.returnTo})},t);var o,r;return new v(i)}))}signupUser(e,t){return Xt(this,void 0,void 0,(function*(){yield this.signupUserRaw(e,t)}))}signupWithInvitationRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.signupWithInvitationRequest)throw new h("signupWithInvitationRequest",'Required parameter "signupWithInvitationRequest" was null or undefined when calling signupWithInvitation().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/auth/signup-with-invitation",method:"POST",headers:n,query:{},body:(r=e.signupWithInvitationRequest,o=r,null==o?o:{email:o.email,password:o.password,role:o.role,plan:o.plan,invitationId:o.invitationId,organizationId:o.organizationId})},t);var o,r;return new v(i)}))}signupWithInvitation(e,t){return Xt(this,void 0,void 0,(function*(){yield this.signupWithInvitationRaw(e,t)}))}updateEmailRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.updateEmailRequest)throw new h("updateEmailRequest",'Required parameter "updateEmailRequest" was null or undefined when calling updateEmail().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/auth/update-email",method:"POST",headers:n,query:{},body:kt(e.updateEmailRequest)},t);return new v(i)}))}updateEmail(e,t){return Xt(this,void 0,void 0,(function*(){yield this.updateEmailRaw(e,t)}))}updateNameRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.updateNameRequest)throw new h("updateNameRequest",'Required parameter "updateNameRequest" was null or undefined when calling updateName().');const n={"Content-Type":"application/json"},i=yield this.request({path:"/auth/update-name",method:"POST",headers:n,query:{},body:(r=e.updateNameRequest,o=r,null==o?o:{token:o.token,name:o.name})},t);var o,r;return new v(i)}))}updateName(e,t){return Xt(this,void 0,void 0,(function*(){yield this.updateNameRaw(e,t)}))}updatePasswordRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.updatePasswordRequest)throw new h("updatePasswordRequest",'Required parameter "updatePasswordRequest" was null or undefined when calling updatePassword().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/auth/update-password",method:"POST",headers:n,query:{},body:(r=e.updatePasswordRequest,o=r,null==o?o:{token:o.token,email:o.email,password:o.password})},t);var o,r;return new v(i)}))}updatePassword(e,t){return Xt(this,void 0,void 0,(function*(){yield this.updatePasswordRaw(e,t)}))}updateUserMetadataRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.updateUserMetadataRequest)throw new h("updateUserMetadataRequest",'Required parameter "updateUserMetadataRequest" was null or undefined when calling updateUserMetadata().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/auth/update-metadata",method:"POST",headers:n,query:{},body:(r=e.updateUserMetadataRequest,o=r,null==o?o:{metadata:o.metadata})},t);var o,r;return new v(i)}))}updateUserMetadata(e,t){return Xt(this,void 0,void 0,(function*(){yield this.updateUserMetadataRaw(e,t)}))}validateInviteCodeRaw(e,t){return Xt(this,void 0,void 0,(function*(){if(null==e.code)throw new h("code",'Required parameter "code" was null or undefined when calling validateInviteCode().');const n={};null!=e.code&&(n.code=e.code);const i=yield this.request({path:"/auth/invite-code",method:"GET",headers:{},query:n},t);return new g(i,(e=>Ut(e)))}))}validateInviteCode(e,t){return Xt(this,void 0,void 0,(function*(){const n=yield this.validateInviteCodeRaw(e,t);return yield n.value()}))}}var en="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))};class tn extends u{checkCompositionAccessRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling checkCompositionAccess().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/access".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>z(e)))}))}checkCompositionAccess(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.checkCompositionAccessRaw(e,t);return yield n.value()}))}createCompositionContentItemRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling createCompositionContentItem().');if(null==e.list)throw new h("list",'Required parameter "list" was null or undefined when calling createCompositionContentItem().');if(null==e.createCompositionContentItemRequest)throw new h("createCompositionContentItemRequest",'Required parameter "createCompositionContentItemRequest" was null or undefined when calling createCompositionContentItem().');const n={"Content-Type":"application/json"};if(null!=e.ifMatch&&(n["If-Match"]=String(e.ifMatch)),null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/content/{list}/items".replace("{id}",encodeURIComponent(String(e.id))).replace("{list}",encodeURIComponent(String(e.list))),method:"POST",headers:n,query:{},body:ee(e.createCompositionContentItemRequest)},t);return new v(i)}))}createCompositionContentItem(e,t){return en(this,void 0,void 0,(function*(){yield this.createCompositionContentItemRaw(e,t)}))}createCompositionDatabaseRecordRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling createCompositionDatabaseRecord().');if(null==e.table)throw new h("table",'Required parameter "table" was null or undefined when calling createCompositionDatabaseRecord().');if(null==e.body)throw new h("body",'Required parameter "body" was null or undefined when calling createCompositionDatabaseRecord().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/database/{table}".replace("{id}",encodeURIComponent(String(e.id))).replace("{table}",encodeURIComponent(String(e.table))),method:"POST",headers:n,query:{},body:e.body},t);return new v(i)}))}createCompositionDatabaseRecord(e,t){return en(this,void 0,void 0,(function*(){yield this.createCompositionDatabaseRecordRaw(e,t)}))}createCompositionRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.newComposition)throw new h("newComposition",'Required parameter "newComposition" was null or undefined when calling createComposition().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions",method:"POST",headers:n,query:{},body:(r=e.newComposition,o=r,null==o?o:{name:o.name,widgetId:o.widgetId,creatorId:o.creatorId,content:o.content,status:o.status,embedSettings:o.embedSettings,design:o.design,databaseSchema:o.databaseSchema,projectId:o.projectId,managedUserId:o.managedUserId,managedUserExternalId:o.managedUserExternalId})},t);var o,r;return new g(i,(e=>te(e)))}))}createComposition(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.createCompositionRaw(e,t);return yield n.value()}))}deleteCompositionContentItemRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling deleteCompositionContentItem().');if(null==e.list)throw new h("list",'Required parameter "list" was null or undefined when calling deleteCompositionContentItem().');if(null==e.itemId)throw new h("itemId",'Required parameter "itemId" was null or undefined when calling deleteCompositionContentItem().');const n={};if(null!=e.ifMatch&&(n["If-Match"]=String(e.ifMatch)),null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/content/{list}/items/{itemId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{list}",encodeURIComponent(String(e.list))).replace("{itemId}",encodeURIComponent(String(e.itemId))),method:"DELETE",headers:n,query:{}},t);return new g(i,(e=>le(e)))}))}deleteCompositionContentItem(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.deleteCompositionContentItemRaw(e,t);return yield n.value()}))}deleteCompositionDataSourceRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling deleteCompositionDataSource().');const n={};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/data-source".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,query:{}},t);return new g(i,(e=>function(e){return null==e?e:{removed:e.removed}}(e)))}))}deleteCompositionDataSource(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.deleteCompositionDataSourceRaw(e,t);return yield n.value()}))}deleteCompositionDatabaseRecordRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling deleteCompositionDatabaseRecord().');if(null==e.table)throw new h("table",'Required parameter "table" was null or undefined when calling deleteCompositionDatabaseRecord().');if(null==e.recordId)throw new h("recordId",'Required parameter "recordId" was null or undefined when calling deleteCompositionDatabaseRecord().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/database/{table}/{recordId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{table}",encodeURIComponent(String(e.table))).replace("{recordId}",encodeURIComponent(String(e.recordId))),method:"DELETE",headers:n,query:{}},t);return new v(i)}))}deleteCompositionDatabaseRecord(e,t){return en(this,void 0,void 0,(function*(){yield this.deleteCompositionDatabaseRecordRaw(e,t)}))}deleteCompositionRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling deleteComposition().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,query:{}},t);return new v(i)}))}deleteComposition(e,t){return en(this,void 0,void 0,(function*(){yield this.deleteCompositionRaw(e,t)}))}describeCompositionEntriesRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling describeCompositionEntries().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/entries".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>V(e)))}))}describeCompositionEntries(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.describeCompositionEntriesRaw(e,t);return yield n.value()}))}duplicateCompositionRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling duplicateComposition().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/duplicate".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(r=e.duplicateCompositionRequest,o=r,null==o?o:{name:o.name,includeDatabase:o.includeDatabase})},t);var o,r;return new g(i,(e=>pe(e)))}))}duplicateComposition(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.duplicateCompositionRaw(e,t);return yield n.value()}))}getAllCompositionsRaw(e,t){return en(this,void 0,void 0,(function*(){const n={};null!=e.page&&(n.page=e.page),null!=e.size&&(n.size=e.size),null!=e.sort&&(n.sort=e.sort),null!=e.widgetId&&(n.widget_id=e.widgetId),null!=e.workspace&&(n.workspace=e.workspace),null!=e.projectFolder&&(n.project_folder=e.projectFolder),null!=e.status&&(n.status=e.status),null!=e.include&&(n.include=e.include),null!=e.managedUserId&&(n.managedUserId=e.managedUserId),null!=e.managedUserExternalId&&(n.managedUserExternalId=e.managedUserExternalId);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions",method:"GET",headers:i,query:n},t);return new g(o,(e=>Re(e)))}))}getAllCompositions(){return en(this,arguments,void 0,(function*(e={},t){const n=yield this.getAllCompositionsRaw(e,t);return yield n.value()}))}getCompositionByIdRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionById().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>te(e)))}))}getCompositionById(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionByIdRaw(e,t);return yield n.value()}))}getCompositionContentSchemaRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionContentSchema().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/schema/content".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>Ae(e)))}))}getCompositionContentSchema(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionContentSchemaRaw(e,t);return yield n.value()}))}getCompositionContentRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionContent().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/content".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i)}))}getCompositionContent(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionContentRaw(e,t);return yield n.value()}))}getCompositionDataSourceRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionDataSource().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/data-source".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>G(e)))}))}getCompositionDataSource(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionDataSourceRaw(e,t);return yield n.value()}))}getCompositionDatabaseRecordRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionDatabaseRecord().');if(null==e.table)throw new h("table",'Required parameter "table" was null or undefined when calling getCompositionDatabaseRecord().');if(null==e.recordId)throw new h("recordId",'Required parameter "recordId" was null or undefined when calling getCompositionDatabaseRecord().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/database/{table}/{recordId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{table}",encodeURIComponent(String(e.table))).replace("{recordId}",encodeURIComponent(String(e.recordId))),method:"GET",headers:n,query:{}},t);return new v(i)}))}getCompositionDatabaseRecord(e,t){return en(this,void 0,void 0,(function*(){yield this.getCompositionDatabaseRecordRaw(e,t)}))}getCompositionDatabaseRecordsRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionDatabaseRecords().');if(null==e.table)throw new h("table",'Required parameter "table" was null or undefined when calling getCompositionDatabaseRecords().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/database/{table}".replace("{id}",encodeURIComponent(String(e.id))).replace("{table}",encodeURIComponent(String(e.table))),method:"GET",headers:n,query:{}},t);return new v(i)}))}getCompositionDatabaseRecords(e,t){return en(this,void 0,void 0,(function*(){yield this.getCompositionDatabaseRecordsRaw(e,t)}))}getCompositionDesignSchemaRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionDesignSchema().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/schema/design".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>be(e)))}))}getCompositionDesignSchema(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionDesignSchemaRaw(e,t);return yield n.value()}))}getCompositionDesignRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionDesign().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/design".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i)}))}getCompositionDesign(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionDesignRaw(e,t);return yield n.value()}))}getCompositionEmbedSchemaRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionEmbedSchema().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/schema/embed".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>Se(e)))}))}getCompositionEmbedSchema(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionEmbedSchemaRaw(e,t);return yield n.value()}))}getCompositionEmbedSettingsRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionEmbedSettings().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/embed-settings".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i)}))}getCompositionEmbedSettings(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionEmbedSettingsRaw(e,t);return yield n.value()}))}getCompositionPreviewRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionPreview().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/preview".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>Be(e)))}))}getCompositionPreview(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionPreviewRaw(e,t);return yield n.value()}))}getCompositionVersionsRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getCompositionVersions().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/versions".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>Ee(e)))}))}getCompositionVersions(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionVersionsRaw(e,t);return yield n.value()}))}getCompositionsBatchRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.getCompositionsBatchRequest)throw new h("getCompositionsBatchRequest",'Required parameter "getCompositionsBatchRequest" was null or undefined when calling getCompositionsBatch().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/batch",method:"POST",headers:n,query:{},body:(r=e.getCompositionsBatchRequest,o=r,null==o?o:{compositionIds:o.compositionIds})},t);var o,r;return new g(i,(e=>De(e)))}))}getCompositionsBatch(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.getCompositionsBatchRaw(e,t);return yield n.value()}))}patchCompositionContentItemRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling patchCompositionContentItem().');if(null==e.list)throw new h("list",'Required parameter "list" was null or undefined when calling patchCompositionContentItem().');if(null==e.itemId)throw new h("itemId",'Required parameter "itemId" was null or undefined when calling patchCompositionContentItem().');if(null==e.requestBody)throw new h("requestBody",'Required parameter "requestBody" was null or undefined when calling patchCompositionContentItem().');const n={"Content-Type":"application/json"};if(null!=e.ifMatch&&(n["If-Match"]=String(e.ifMatch)),null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/content/{list}/items/{itemId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{list}",encodeURIComponent(String(e.list))).replace("{itemId}",encodeURIComponent(String(e.itemId))),method:"PATCH",headers:n,query:{},body:e.requestBody},t);return new v(i)}))}patchCompositionContentItem(e,t){return en(this,void 0,void 0,(function*(){yield this.patchCompositionContentItemRaw(e,t)}))}readCompositionEntriesRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling readCompositionEntries().');if(null==e.table)throw new h("table",'Required parameter "table" was null or undefined when calling readCompositionEntries().');const n={};null!=e.groupBy&&(n.groupBy=e.groupBy),null!=e.rows&&(n.rows=e.rows),null!=e.aggregate&&(n.aggregate=e.aggregate),null!=e.column&&(n.column=e.column),null!=e.since&&(n.since=e.since.toISOString()),null!=e.until&&(n.until=e.until.toISOString()),null!=e.context&&(n.context=e.context),null!=e.filter&&(n.filter=e.filter);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/compositions/{id}/entries/{table}".replace("{id}",encodeURIComponent(String(e.id))).replace("{table}",encodeURIComponent(String(e.table))),method:"GET",headers:i,query:n},t);return new g(o,(e=>J(e)))}))}readCompositionEntries(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.readCompositionEntriesRaw(e,t);return yield n.value()}))}setCompositionDataSourceRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling setCompositionDataSource().');if(null==e.setCompositionDataSourceRequest)throw new h("setCompositionDataSourceRequest",'Required parameter "setCompositionDataSourceRequest" was null or undefined when calling setCompositionDataSource().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/data-source".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:n,query:{},body:(r=e.setCompositionDataSourceRequest,o=r,null==o?o:{url:o.url,refresh_seconds:o.refresh_seconds})},t);var o,r;return new g(i,(e=>G(e)))}))}setCompositionDataSource(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.setCompositionDataSourceRaw(e,t);return yield n.value()}))}setDynamicContentRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling setDynamicContent().');if(null==e.setDynamicContentRequest)throw new h("setDynamicContentRequest",'Required parameter "setDynamicContentRequest" was null or undefined when calling setDynamicContent().');const n={"Content-Type":"application/json"};if(null!=e.ifMatch&&(n["If-Match"]=String(e.ifMatch)),null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/content".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:n,query:{},body:(r=e.setDynamicContentRequest,o=r,null==o?o:{content:o.content,validate:o.validate,partial:o.partial,version:o.version,source:o.source})},t);var o,r;return new g(i,(e=>dt(e)))}))}setDynamicContent(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.setDynamicContentRaw(e,t);return yield n.value()}))}updateCompositionDatabaseRecordRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling updateCompositionDatabaseRecord().');if(null==e.table)throw new h("table",'Required parameter "table" was null or undefined when calling updateCompositionDatabaseRecord().');if(null==e.recordId)throw new h("recordId",'Required parameter "recordId" was null or undefined when calling updateCompositionDatabaseRecord().');if(null==e.body)throw new h("body",'Required parameter "body" was null or undefined when calling updateCompositionDatabaseRecord().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/database/{table}/{recordId}".replace("{id}",encodeURIComponent(String(e.id))).replace("{table}",encodeURIComponent(String(e.table))).replace("{recordId}",encodeURIComponent(String(e.recordId))),method:"PUT",headers:n,query:{},body:e.body},t);return new v(i)}))}updateCompositionDatabaseRecord(e,t){return en(this,void 0,void 0,(function*(){yield this.updateCompositionDatabaseRecordRaw(e,t)}))}updateCompositionStatusRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling updateCompositionStatus().');if(null==e.updateCompositionStatusRequest)throw new h("updateCompositionStatusRequest",'Required parameter "updateCompositionStatusRequest" was null or undefined when calling updateCompositionStatus().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/status".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:n,query:{},body:(r=e.updateCompositionStatusRequest,o=r,null==o?o:{status:o.status})},t);var o,r;return new g(i,(e=>$(e)))}))}updateCompositionStatus(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.updateCompositionStatusRaw(e,t);return yield n.value()}))}updateCompositionRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling updateComposition().');if(null==e.updateComposition)throw new h("updateComposition",'Required parameter "updateComposition" was null or undefined when calling updateComposition().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:n,query:{},body:(r=e.updateComposition,o=r,null==o?o:{name:o.name,widgetId:o.widgetId,content:o.content,status:o.status,embedSettings:o.embedSettings,design:o.design,projectId:o.projectId})},t);var o,r;return new g(i,(e=>te(e)))}))}updateComposition(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.updateCompositionRaw(e,t);return yield n.value()}))}validateCompositionContentRaw(e,t){return en(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling validateCompositionContent().');if(null==e.body)throw new h("body",'Required parameter "body" was null or undefined when calling validateCompositionContent().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/compositions/{id}/content/validate".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:e.body},t);return new g(i,(e=>_t(e)))}))}validateCompositionContent(e,t){return en(this,void 0,void 0,(function*(){const n=yield this.validateCompositionContentRaw(e,t);return yield n.value()}))}}var nn="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))};class on extends u{exchangeTokenRaw(e,t){return nn(this,void 0,void 0,(function*(){if(null==e.exchangeTokenRequest)throw new h("exchangeTokenRequest",'Required parameter "exchangeTokenRequest" was null or undefined when calling exchangeToken().');const n={"Content-Type":"application/json"};this.configuration&&this.configuration.apiKey&&(n.Authorization=yield this.configuration.apiKey("Authorization"));const i=yield this.request({path:"/tokens/exchange",method:"POST",headers:n,query:{},body:(r=e.exchangeTokenRequest,o=r,null==o?o:{scopes:o.scopes,expiresIn:o.expiresIn})},t);var o,r;return new g(i,(e=>ve(e)))}))}exchangeToken(e,t){return nn(this,void 0,void 0,(function*(){const n=yield this.exchangeTokenRaw(e,t);return yield n.value()}))}validateTokenRaw(e){return nn(this,void 0,void 0,(function*(){const t={};if(this.configuration&&this.configuration.apiKey&&(t.Authorization=yield this.configuration.apiKey("Authorization")),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,n=yield e("BearerAuth",[]);n&&(t.Authorization=`Bearer ${n}`)}const n=yield this.request({path:"/tokens/validate",method:"GET",headers:t,query:{}},e);return new g(n,(e=>Wt(e)))}))}validateToken(e){return nn(this,void 0,void 0,(function*(){const t=yield this.validateTokenRaw(e);return yield t.value()}))}}var rn="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))};class sn extends u{addLanguagesToTranslationRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling addLanguagesToTranslation().');if(null==e.addLanguagesToTranslationRequest)throw new h("addLanguagesToTranslationRequest",'Required parameter "addLanguagesToTranslationRequest" was null or undefined when calling addLanguagesToTranslation().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/translations/{id}/languages".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(r=e.addLanguagesToTranslationRequest,o=r,null==o?o:{languages:o.languages})},t);var o,r;return new g(i,(e=>S(e)))}))}addLanguagesToTranslation(e,t){return rn(this,void 0,void 0,(function*(){const n=yield this.addLanguagesToTranslationRaw(e,t);return yield n.value()}))}createTranslationRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.createTranslationRequest)throw new h("createTranslationRequest",'Required parameter "createTranslationRequest" was null or undefined when calling createTranslation().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/translations",method:"POST",headers:n,query:{},body:(r=e.createTranslationRequest,o=r,null==o?o:{name:o.name,description:o.description,root_composition_id:o.root_composition_id,root_language:o.root_language,selected_languages:o.selected_languages})},t);var o,r;return new g(i,(e=>ne(e)))}))}createTranslation(e,t){return rn(this,void 0,void 0,(function*(){const n=yield this.createTranslationRaw(e,t);return yield n.value()}))}deleteTranslationRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling deleteTranslation().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/translations/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,query:{}},t);return new g(i,(e=>Et(e)))}))}deleteTranslation(e,t){return rn(this,void 0,void 0,(function*(){const n=yield this.deleteTranslationRaw(e,t);return yield n.value()}))}getLanguagePresetsRaw(e){return rn(this,void 0,void 0,(function*(){const t=yield this.request({path:"/translations/language-presets",method:"GET",headers:{},query:{}},e);return new g(t,(e=>Pe(e)))}))}getLanguagePresets(e){return rn(this,void 0,void 0,(function*(){const t=yield this.getLanguagePresetsRaw(e);return yield t.value()}))}getSupportedLanguagesRaw(e){return rn(this,void 0,void 0,(function*(){const t=yield this.request({path:"/translations/supported-languages",method:"GET",headers:{},query:{}},e);return new g(t,(e=>ze(e)))}))}getSupportedLanguages(e){return rn(this,void 0,void 0,(function*(){const t=yield this.getSupportedLanguagesRaw(e);return yield t.value()}))}getTranslationRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getTranslation().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/translations/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>Oe(e)))}))}getTranslation(e,t){return rn(this,void 0,void 0,(function*(){const n=yield this.getTranslationRaw(e,t);return yield n.value()}))}getTranslationAnalyticsRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getTranslationAnalytics().');const n={};null!=e.period&&(n.period=e.period);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/translations/{id}/analytics".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:i,query:n},t);return new g(o,(e=>Ge(e)))}))}getTranslationAnalytics(e,t){return rn(this,void 0,void 0,(function*(){const n=yield this.getTranslationAnalyticsRaw(e,t);return yield n.value()}))}getTranslationConfigRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getTranslationConfig().');const n=yield this.request({path:"/translations/{id}/config".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:{},query:{}},t);return new g(n,(e=>Me(e)))}))}getTranslationConfig(e,t){return rn(this,void 0,void 0,(function*(){const n=yield this.getTranslationConfigRaw(e,t);return yield n.value()}))}getTranslationsRaw(e,t){return rn(this,void 0,void 0,(function*(){const n={};null!=e.status&&(n.status=e.status);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/translations",method:"GET",headers:i,query:n},t);return new g(o,(e=>Ve(e)))}))}getTranslations(){return rn(this,arguments,void 0,(function*(e={},t){const n=yield this.getTranslationsRaw(e,t);return yield n.value()}))}removeLanguageFromTranslationRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling removeLanguageFromTranslation().');if(null==e.languageCode)throw new h("languageCode",'Required parameter "languageCode" was null or undefined when calling removeLanguageFromTranslation().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/translations/{id}/languages/{languageCode}".replace("{id}",encodeURIComponent(String(e.id))).replace("{languageCode}",encodeURIComponent(String(e.languageCode))),method:"DELETE",headers:n,query:{}},t);return new g(i,(e=>S(e)))}))}removeLanguageFromTranslation(e,t){return rn(this,void 0,void 0,(function*(){const n=yield this.removeLanguageFromTranslationRaw(e,t);return yield n.value()}))}retranslateExperimentRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling retranslateExperiment().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/translations/{id}/retranslate".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(r=e.retranslateExperimentRequest,o=r,null==o?o:{languages:o.languages})},t);var o,r;return new g(i,(e=>Et(e)))}))}retranslateExperiment(e,t){return rn(this,void 0,void 0,(function*(){const n=yield this.retranslateExperimentRaw(e,t);return yield n.value()}))}submitTranslationAnalyticsEventRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling submitTranslationAnalyticsEvent().');if(null==e.submitTranslationAnalyticsEventRequest)throw new h("submitTranslationAnalyticsEventRequest",'Required parameter "submitTranslationAnalyticsEventRequest" was null or undefined when calling submitTranslationAnalyticsEvent().');const n={"Content-Type":"application/json"};null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey));const i=yield this.request({path:"/translations/{id}/analytics/events".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(r=e.submitTranslationAnalyticsEventRequest,o=r,null==o?o:{eventType:o.eventType,language:o.language,compositionId:o.compositionId,metadata:o.metadata})},t);var o,r;return new v(i)}))}submitTranslationAnalyticsEvent(e,t){return rn(this,void 0,void 0,(function*(){yield this.submitTranslationAnalyticsEventRaw(e,t)}))}updateTranslationStatusRaw(e,t){return rn(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling updateTranslationStatus().');if(null==e.updateTranslationStatusRequest)throw new h("updateTranslationStatusRequest",'Required parameter "updateTranslationStatusRequest" was null or undefined when calling updateTranslationStatus().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("BearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/translations/{id}/status".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:n,query:{},body:(r=e.updateTranslationStatusRequest,o=r,null==o?o:{status:o.status})},t);var o,r;return new g(i,(e=>S(e)))}))}updateTranslationStatus(e,t){return rn(this,void 0,void 0,(function*(){const n=yield this.updateTranslationStatusRaw(e,t);return yield n.value()}))}}var an="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function a(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}d((i=i.apply(e,t||[])).next())}))};class dn extends u{checkWidgetAccessRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling checkWidgetAccess().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}/access".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>O(e)))}))}checkWidgetAccess(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.checkWidgetAccessRaw(e,t);return yield n.value()}))}createCompositionFromWidgetRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling createCompositionFromWidget().');if(null==e.createCompositionFromWidgetRequest)throw new h("createCompositionFromWidgetRequest",'Required parameter "createCompositionFromWidgetRequest" was null or undefined when calling createCompositionFromWidget().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}/composition".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(r=e.createCompositionFromWidgetRequest,o=r,null==o?o:{name:o.name,content:o.content,design:o.design,embed_settings:o.embed_settings,locale:o.locale,managed_user_id:o.managed_user_id})},t);var o,r;return new g(i,(e=>te(e)))}))}createCompositionFromWidget(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.createCompositionFromWidgetRaw(e,t);return yield n.value()}))}createWidgetRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.newWidget)throw new h("newWidget",'Required parameter "newWidget" was null or undefined when calling createWidget().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets",method:"POST",headers:n,query:{},body:(r=e.newWidget,o=r,null==o?o:{name:o.name,type:o.type,content:o.content,isPublic:o.isPublic,isDraft:o.isDraft,canvasId:o.canvasId,projectId:o.projectId,organizationId:o.organizationId,workspaceType:o.workspaceType,managedUserId:o.managedUserId,managedUserExternalId:o.managedUserExternalId})},t);var o,r;return new g(i,(e=>ae(e)))}))}createWidget(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.createWidgetRaw(e,t);return yield n.value()}))}deleteWidgetRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling deleteWidget().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("bearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"DELETE",headers:n,query:{},body:(r=e.deleteWidgetRequest,o=r,null==o?o:{reason:o.reason})},t);var o,r;return new v(i)}))}deleteWidget(e,t){return an(this,void 0,void 0,(function*(){yield this.deleteWidgetRaw(e,t)}))}detachWidgetRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling detachWidget().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}/detach".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{}},t);return new v(i)}))}detachWidget(e,t){return an(this,void 0,void 0,(function*(){yield this.detachWidgetRaw(e,t)}))}duplicateWidgetRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling duplicateWidget().');const n={"Content-Type":"application/json"};if(null!=e.idempotencyKey&&(n["Idempotency-Key"]=String(e.idempotencyKey)),this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("bearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}/duplicate".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(r=e.duplicateWidgetRequest,o=r,null==o?o:{name:o.name,canvas_id:o.canvas_id,managedUserId:o.managedUserId,managedUserExternalId:o.managedUserExternalId})},t);var o,r;return new g(i,(e=>me(e)))}))}duplicateWidget(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.duplicateWidgetRaw(e,t);return yield n.value()}))}getWidgetContentSchemaRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getWidgetContentSchema().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}/schema/content".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i)}))}getWidgetContentSchema(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.getWidgetContentSchemaRaw(e,t);return yield n.value()}))}getWidgetDesignSchemaRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling getWidgetDesignSchema().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}/schema/design".replace("{id}",encodeURIComponent(String(e.id))),method:"GET",headers:n,query:{}},t);return new g(i)}))}getWidgetDesignSchema(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.getWidgetDesignSchemaRaw(e,t);return yield n.value()}))}getWidgetPublishHistoryRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.widgetId)throw new h("widgetId",'Required parameter "widgetId" was null or undefined when calling getWidgetPublishHistory().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("bearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{widgetId}/publish-history".replace("{widgetId}",encodeURIComponent(String(e.widgetId))),method:"GET",headers:n,query:{}},t);return new g(i,(e=>He(e)))}))}getWidgetPublishHistory(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.getWidgetPublishHistoryRaw(e,t);return yield n.value()}))}getWidgetsBatchRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.getWidgetsBatchRequest)throw new h("getWidgetsBatchRequest",'Required parameter "getWidgetsBatchRequest" was null or undefined when calling getWidgetsBatch().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/batch",method:"POST",headers:n,query:{},body:(r=e.getWidgetsBatchRequest,o=r,null==o?o:{widgetIds:o.widgetIds})},t);var o,r;return new g(i,(e=>Qe(e)))}))}getWidgetsBatch(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.getWidgetsBatchRaw(e,t);return yield n.value()}))}getWidgetsRaw(e,t){return an(this,void 0,void 0,(function*(){const n={};null!=e.page&&(n.page=e.page),null!=e.size&&(n.size=e.size),null!=e.canvasId&&(n.canvasId=e.canvasId),null!=e.managedUserId&&(n.managedUserId=e.managedUserId),null!=e.managedUserExternalId&&(n.managedUserExternalId=e.managedUserExternalId);const i={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(i.Authorization=`Bearer ${t}`)}const o=yield this.request({path:"/widgets",method:"GET",headers:i,query:n},t);return new g(o,(e=>Ze(e)))}))}getWidgets(){return an(this,arguments,void 0,(function*(e={},t){const n=yield this.getWidgetsRaw(e,t);return yield n.value()}))}renameWidgetPublishHistoryTitleRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.widgetId)throw new h("widgetId",'Required parameter "widgetId" was null or undefined when calling renameWidgetPublishHistoryTitle().');if(null==e.version)throw new h("version",'Required parameter "version" was null or undefined when calling renameWidgetPublishHistoryTitle().');if(null==e.renameWidgetPublishHistoryTitleRequest)throw new h("renameWidgetPublishHistoryTitleRequest",'Required parameter "renameWidgetPublishHistoryTitleRequest" was null or undefined when calling renameWidgetPublishHistoryTitle().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("bearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{widgetId}/publish-history/{version}/title".replace("{widgetId}",encodeURIComponent(String(e.widgetId))).replace("{version}",encodeURIComponent(String(e.version))),method:"PATCH",headers:n,query:{},body:(r=e.renameWidgetPublishHistoryTitleRequest,o=r,null==o?o:{commitTitle:o.commitTitle})},t);var o,r;return new g(i,(e=>rt(e)))}))}renameWidgetPublishHistoryTitle(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.renameWidgetPublishHistoryTitleRaw(e,t);return yield n.value()}))}setWidgetPublishHistoryLiveRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.widgetId)throw new h("widgetId",'Required parameter "widgetId" was null or undefined when calling setWidgetPublishHistoryLive().');if(null==e.version)throw new h("version",'Required parameter "version" was null or undefined when calling setWidgetPublishHistoryLive().');const n={};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("bearerAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{widgetId}/publish-history/{version}/set-live".replace("{widgetId}",encodeURIComponent(String(e.widgetId))).replace("{version}",encodeURIComponent(String(e.version))),method:"POST",headers:n,query:{}},t);return new g(i,(e=>ct(e)))}))}setWidgetPublishHistoryLive(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.setWidgetPublishHistoryLiveRaw(e,t);return yield n.value()}))}updateWidgetRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling updateWidget().');if(null==e.updateWidgetRequest)throw new h("updateWidgetRequest",'Required parameter "updateWidgetRequest" was null or undefined when calling updateWidget().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}".replace("{id}",encodeURIComponent(String(e.id))),method:"PATCH",headers:n,query:{},body:(r=e.updateWidgetRequest,o=r,null==o?o:{name:o.name,description:o.description,canvasId:o.canvasId,projectId:o.projectId,projectFolder:o.projectFolder})},t);var o,r;return new v(i)}))}updateWidget(e,t){return an(this,void 0,void 0,(function*(){yield this.updateWidgetRaw(e,t)}))}updateWidgetRepositoryRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling updateWidgetRepository().');if(null==e.updateWidgetRepositoryRequest)throw new h("updateWidgetRepositoryRequest",'Required parameter "updateWidgetRepositoryRequest" was null or undefined when calling updateWidgetRepository().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}/repository".replace("{id}",encodeURIComponent(String(e.id))),method:"PUT",headers:n,query:{},body:(r=e.updateWidgetRepositoryRequest,o=r,null==o?o:{repositoryId:o.repositoryId})},t);var o,r;return new g(i,(e=>bt(e)))}))}updateWidgetRepository(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.updateWidgetRepositoryRaw(e,t);return yield n.value()}))}uploadWidgetThumbnailRaw(e,t){return an(this,void 0,void 0,(function*(){if(null==e.id)throw new h("id",'Required parameter "id" was null or undefined when calling uploadWidgetThumbnail().');if(null==e.uploadWidgetThumbnailRequest)throw new h("uploadWidgetThumbnailRequest",'Required parameter "uploadWidgetThumbnailRequest" was null or undefined when calling uploadWidgetThumbnail().');const n={"Content-Type":"application/json"};if(this.configuration&&this.configuration.accessToken){const e=this.configuration.accessToken,t=yield e("apiKeyAuth",[]);t&&(n.Authorization=`Bearer ${t}`)}const i=yield this.request({path:"/widgets/{id}/thumbnail".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(r=e.uploadWidgetThumbnailRequest,o=r,null==o?o:{imageDataUrl:o.imageDataUrl})},t);var o,r;return new g(i,(e=>Bt(e)))}))}uploadWidgetThumbnail(e,t){return an(this,void 0,void 0,(function*(){const n=yield this.uploadWidgetThumbnailRaw(e,t);return yield n.value()}))}}const un=e=>null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e);function ln(e){if(Array.isArray(e))return e.map(ln);if(!un(e))return e;const t={};for(const[n,i]of Object.entries(e)){t[n.replace(/[_-](\w)/g,((e,t)=>t?t.toUpperCase():""))]=Array.isArray(i)?i.map(ln):un(i)?ln(i):i}return t}function cn(e){if(Array.isArray(e))return e.map(cn);if(!un(e))return e;const t={};for(const[n,i]of Object.entries(e)){t[n.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toLowerCase()]=Array.isArray(i)?i.map(cn):un(i)?cn(i):i}return t}class hn{constructor(){this.sessionCache=null,this.sessionCacheExpiry=0,this.ownershipCache=new Map;const e=t(),n=new a({basePath:e.basePath,apiKey:e.apiKey,credentials:"include"});this.authApi=new Yt(n),this.compositionsApi=new tn(n)}checkAuthentication(){return e(this,void 0,void 0,(function*(){try{if(this.sessionCache&&Date.now()<this.sessionCacheExpiry)return{isAuthenticated:!0,session:this.sessionCache,user:this.sessionCache.user,canEdit:!0};const e=ln(yield this.authApi.getSession());return e&&e.accessToken&&e.user?(this.sessionCache=e,this.sessionCacheExpiry=Date.now()+3e5,n.info("User authenticated for editing",{userId:e.user.id,email:e.user.email}),{isAuthenticated:!0,session:e,user:e.user,canEdit:!0}):{isAuthenticated:!1,canEdit:!1}}catch(e){return n.debug("Authentication check failed",{error:e}),e instanceof Response&&e.status,{isAuthenticated:!1,canEdit:!1}}}))}checkCompositionOwnership(t){return e(this,void 0,void 0,(function*(){var e;try{const i=this.ownershipCache.get(t);if(i)return i;const o=yield this.checkAuthentication();if(!o.isAuthenticated||!(null===(e=o.session)||void 0===e?void 0:e.user)){const e={isOwner:!1,canEdit:!1,error:"User not authenticated"};return this.ownershipCache.set(t,e),e}const r=ln(yield this.compositionsApi.getCompositionById({id:t}));if(!r){const e={isOwner:!1,canEdit:!1,error:"Composition not found"};return this.ownershipCache.set(t,e),e}const s=r.creatorId===o.session.user.id,a={isOwner:s,canEdit:s,composition:r,error:s?void 0:"User does not own this composition"};return this.ownershipCache.set(t,a),setTimeout((()=>{this.ownershipCache.delete(t)}),12e4),n.debug("Composition ownership checked",{compositionId:t,isOwner:s,userId:o.session.user.id,compositionCreatorId:r.creatorId}),a}catch(e){n.warn("Failed to check composition ownership",{compositionId:t,error:e});const i={isOwner:!1,canEdit:!1,error:e instanceof Error?e.message:"Unknown error"};return this.ownershipCache.set(t,i),i}}))}canEditComposition(t){return e(this,void 0,void 0,(function*(){return(yield this.checkCompositionOwnership(t)).canEdit}))}getCurrentUser(){return e(this,void 0,void 0,(function*(){return(yield this.checkAuthentication()).user||null}))}clearCache(){this.sessionCache=null,this.sessionCacheExpiry=0,this.ownershipCache.clear(),n.debug("Authentication cache cleared")}checkMultipleCompositions(t){return e(this,void 0,void 0,(function*(){const n=new Map;return(yield this.checkAuthentication()).isAuthenticated?(yield Promise.all(t.map((t=>e(this,void 0,void 0,(function*(){const e=yield this.checkCompositionOwnership(t);n.set(t,e)}))))),n):(t.forEach((e=>{n.set(e,{isOwner:!1,canEdit:!1,error:"User not authenticated"})})),n)}))}isEditingEnabled(){return i.ENABLE_EDITING}}let pn=null;function fn(){return pn||(pn=new hn),pn}class mn{constructor(e={}){this.host=null,this.container=null,this.content=null,this.destroyed=!1,this.options=Object.assign({target:"widgetic-portal",className:"",style:"",clickThrough:!1,zIndex:99999999},e),this.createPortal()}createPortal(){this.host=this.findOrCreateHost(),this.container=document.createElement("div"),this.container.className=(this.options.className?this.options.className+" ":"")+"widgetic-portal-contents",this.container.style.cssText=`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: ${this.options.zIndex};\n pointer-events: ${this.options.clickThrough?"none":"auto"};\n ${this.options.style}\n `,this.options.clickThrough?this.container.style.pointerEvents="none":this.container.style.pointerEvents="auto",this.host.appendChild(this.container),n.debug("Portal created",{target:this.options.target,host:this.host,container:this.container})}findOrCreateHost(){let e=null;if(this.options.target instanceof HTMLElement)return this.options.target;if("string"==typeof this.options.target){const t=`.${this.options.target}`;e=document.querySelector(t)}return e||(e=document.createElement("div"),e.classList.add("string"==typeof this.options.target?this.options.target:"widgetic-portal"),document.body.appendChild(e),n.debug("Portal host created",{target:this.options.target,host:e})),e}mount(e){this.destroyed?n.warn("Cannot mount content to destroyed portal"):this.container?(this.content&&this.unmount(),e.style.pointerEvents="auto",this.content=e,this.container.appendChild(e),n.debug("Content mounted to portal",{content:e})):n.error("Portal container not available")}unmount(){this.content&&this.container&&this.container.contains(this.content)&&(this.container.removeChild(this.content),this.content=null,n.debug("Content unmounted from portal"))}destroy(){if(!this.destroyed){if(this.unmount(),this.container&&this.host&&this.host.contains(this.container)&&this.host.removeChild(this.container),this.host&&0===this.host.childNodes.length&&this.host.parentNode){const e="string"==typeof this.options.target?this.options.target:"widgetic-portal";this.host.classList.contains(e)&&this.host.parentNode.removeChild(this.host)}this.destroyed=!0,this.host=null,this.container=null,this.content=null,n.debug("Portal destroyed")}}getContainer(){return this.container}isDestroyed(){return this.destroyed}updateOptions(e){this.destroyed?n.warn("Cannot update options on destroyed portal"):(this.options=Object.assign(Object.assign({},this.options),e),this.container&&(void 0!==e.className&&(this.container.className=(e.className?e.className+" ":"")+"widgetic-portal-contents"),void 0!==e.style&&(this.container.style.cssText=`\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: ${this.options.zIndex};\n pointer-events: ${this.options.clickThrough,"none"};\n ${this.options.style}\n `),void 0!==e.clickThrough&&(this.container.style.pointerEvents=(e.clickThrough,"none"))),n.debug("Portal options updated",{options:this.options}))}}function gn(e){return new mn(e)}class vn{constructor(e={}){this.config=e,this.loadPromise=null,this.sdkInstance=null,this.isLoading=!1,this.loadTimeout=3e4,this.config=Object.assign({basePath:e.basePath||this.getUISdkBaseUrl(),version:e.version||"latest",debug:e.debug||!1},e)}getUISdkBaseUrl(){return"development"===i.NODE_ENV?i.CLIENT_URL:`${i.PRODUCTION_URL}/ui-sdk`}loadUISdk(){return e(this,void 0,void 0,(function*(){if(this.sdkInstance)return this.sdkInstance;if(this.loadPromise)return this.loadPromise;this.isLoading=!0,this.loadPromise=this.performLoad();try{return this.sdkInstance=yield this.loadPromise,n.info("UI SDK loaded successfully",{basePath:this.config.basePath,version:this.config.version}),this.sdkInstance}catch(e){throw n.error("Failed to load UI SDK",{error:e,config:this.config}),this.loadPromise=null,e}finally{this.isLoading=!1}}))}performLoad(){return e(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{const i=setTimeout((()=>{t(new Error("UI SDK load timeout"))}),this.loadTimeout);try{if(window.WidgeticUI)return clearTimeout(i),void e(window.WidgeticUI);const o=document.createElement("script");o.src=`${this.config.basePath}/widgetic-ui.js`,o.async=!0,o.crossOrigin="anonymous",o.onload=()=>{clearTimeout(i),window.WidgeticUI?(n.debug("UI SDK script loaded from external source"),e(window.WidgeticUI)):t(new Error("UI SDK script loaded but WidgeticUI not available"))},o.onerror=()=>{clearTimeout(i),t(new Error("Failed to load UI SDK script"))},document.head.appendChild(o),n.debug("Loading UI SDK",{src:o.src})}catch(e){clearTimeout(i),t(e)}}))}))}isLoaded(){return null!==this.sdkInstance}isLoadingState(){return this.isLoading}getInstance(){return this.sdkInstance}initializeUISdk(t){return e(this,void 0,void 0,(function*(){const e=yield this.loadUISdk();return yield e.init(Object.assign(Object.assign({},this.config),t)),n.info("UI SDK initialized",{config:Object.assign(Object.assign({},this.config),t)}),e}))}cleanup(){return e(this,void 0,void 0,(function*(){if(this.sdkInstance){try{yield this.sdkInstance.destroy()}catch(e){n.warn("Error during UI SDK cleanup",{error:e})}this.sdkInstance=null}this.loadPromise=null,this.isLoading=!1,window.WidgeticUI&&delete window.WidgeticUI,n.debug("UI SDK cleanup complete")}))}preload(){return e(this,void 0,void 0,(function*(){try{yield this.loadUISdk(),n.debug("UI SDK preloaded successfully")}catch(e){n.warn("UI SDK preload failed",{error:e})}}))}}let wn=null;function yn(e){return wn||(wn=new vn(e)),wn}class In{constructor(e={}){this.options=e,this.sessions=new Map,this.defaultOptions={showEditButton:!0,editButtonText:"✏️ Edit",editButtonPosition:"top-right",enableClickToEdit:!0,autoDetectAuth:!0},this.options=Object.assign(Object.assign({},this.defaultOptions),e)}addOverlay(t,i){return e(this,void 0,void 0,(function*(){try{if(!this.options.autoDetectAuth)return void(yield this.createOverlay(t,i,!0));const e=fn(),o=yield e.checkCompositionOwnership(i);o.canEdit?(yield this.createOverlay(t,i,!0),n.debug("Editor overlay added for owned composition",{compositionId:i})):n.debug("Editor overlay not added - user cannot edit",{compositionId:i,reason:o.error})}catch(e){n.warn("Failed to add editor overlay",{compositionId:i,error:e})}}))}createOverlay(t,i,o){return e(this,void 0,void 0,(function*(){if(this.sessions.has(i))return;const e=document.createElement("div");if(e.className="widgetic-editor-overlay",e.style.cssText=`\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 10000;\n pointer-events: none;\n ${this.getOverlayStyles()}\n `,this.options.showEditButton&&o){const t=this.createEditButton(i);e.appendChild(t)}this.options.enableClickToEdit&&o&&this.addClickToEdit(e,i);const r=t.parentElement;if(r){"static"===window.getComputedStyle(r).position&&(r.style.position="relative"),r.appendChild(e)}else t.style.position="relative",t.appendChild(e);const s={compositionId:i,isOpen:!1,overlay:e};this.sessions.set(i,s),n.debug("Editor overlay created",{compositionId:i})}))}createEditButton(t){const n=document.createElement("button");return n.className="widgetic-edit-button",n.textContent=this.options.editButtonText||"✏️ Edit",n.style.cssText=`\n position: absolute;\n ${this.getButtonPositionStyles()}\n background: #007bff;\n color: white;\n border: none;\n border-radius: 4px;\n padding: 8px 12px;\n font-size: 12px;\n font-weight: 500;\n cursor: pointer;\n pointer-events: auto;\n box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n transition: all 0.2s ease;\n z-index: 10001;\n ${this.getCustomButtonStyles()}\n `,n.addEventListener("mouseenter",(()=>{n.style.background="#0056b3",n.style.transform="scale(1.05)"})),n.addEventListener("mouseleave",(()=>{n.style.background="#007bff",n.style.transform="scale(1)"})),n.addEventListener("click",(n=>e(this,void 0,void 0,(function*(){n.preventDefault(),n.stopPropagation(),yield this.openEditor(t)})))),n}getButtonPositionStyles(){const e="10px";switch(this.options.editButtonPosition||"top-right"){case"top-left":return`top: ${e}; left: ${e};`;case"top-right":default:return`top: ${e}; right: ${e};`;case"bottom-left":return`bottom: ${e}; left: ${e};`;case"bottom-right":return`bottom: ${e}; right: ${e};`}}getCustomButtonStyles(){return this.options.editButtonStyle?Object.entries(this.options.editButtonStyle).map((([e,t])=>`${this.camelToKebab(e)}: ${t};`)).join(" "):""}getOverlayStyles(){return this.options.overlayStyle?Object.entries(this.options.overlayStyle).map((([e,t])=>`${this.camelToKebab(e)}: ${t};`)).join(" "):""}camelToKebab(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}addClickToEdit(t,n){t.style.cursor="pointer",t.style.pointerEvents="auto",t.addEventListener("click",(i=>e(this,void 0,void 0,(function*(){i.target===t&&(i.preventDefault(),i.stopPropagation(),yield this.openEditor(n))})))),t.addEventListener("mouseenter",(()=>{t.style.backgroundColor="rgba(0, 123, 255, 0.1)",t.style.border="2px dashed #007bff"})),t.addEventListener("mouseleave",(()=>{t.style.backgroundColor="transparent",t.style.border="none"}))}createEditorContainer(){const e=new mn({target:"widgetic-editor-portal",className:"widgetic-editor-modal",zIndex:1e5,clickThrough:!1});const t=document.createElement("div");t.className="widgetic-editor-modal-backdrop",t.style.cssText="\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background: rgba(0, 0, 0, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n ";const n=document.createElement("div");return n.className="widgetic-editor-content",n.style.cssText="\n width: 90vw;\n height: 90vh;\n max-width: 1200px;\n max-height: 800px;\n background: white;\n border-radius: 8px;\n overflow: hidden;\n position: relative;\n ",t.appendChild(n),e.mount(t),{container:t,portal:e}}openEditor(t){return e(this,void 0,void 0,(function*(){try{const e=this.sessions.get(t);if(!e)return void n.warn("No editor session found",{compositionId:t});if(e.isOpen)return void n.debug("Editor already open",{compositionId:t});n.info("Opening composition editor",{compositionId:t});const i=yn(),r=yield i.initializeUISdk(),{container:s,portal:a}=this.createEditorContainer(),d=yield r.mountCompositionEditor(s.querySelector(".widgetic-editor-content"),t,{onSave:e=>this.handleEditorSave(t,e),onClose:()=>this.closeEditor(t),onPreview:e=>this.handleEditorPreview(t,e)}),u=o().createWidgetController(t);if(e.isOpen=!0,e.editorContainer=s,e.editorInstance=d,e.widgetController=u,e.portal=a,e.overlay){const t=e.overlay.querySelector(".widgetic-edit-button");t&&(t.style.display="none")}n.info("Composition editor opened successfully",{compositionId:t})}catch(e){n.error("Failed to open editor",{compositionId:t,error:e}),this.showError("Failed to open editor. Please try again.",t)}}))}handleEditorSave(t,i){return e(this,void 0,void 0,(function*(){try{n.info("Saving composition changes",{compositionId:t,data:i});const e=this.sessions.get(t);(null==e?void 0:e.widgetController)&&(yield e.widgetController.updateConfig(i),yield e.widgetController.refresh()),yield this.closeEditor(t),n.info("Composition saved successfully",{compositionId:t})}catch(e){n.error("Failed to save composition",{compositionId:t,error:e}),this.showError("Failed to save changes. Please try again.",t)}}))}handleEditorPreview(t,i){return e(this,void 0,void 0,(function*(){try{const e=this.sessions.get(t);(null==e?void 0:e.widgetController)&&(yield e.widgetController.callFunction("preview",i))}catch(e){n.warn("Preview update failed",{compositionId:t,error:e})}}))}closeEditor(t){return e(this,void 0,void 0,(function*(){const e=this.sessions.get(t);if(e&&e.isOpen)try{if(e.editorInstance&&e.editorContainer){const t=yn().getInstance();t&&(yield t.unmountCompositionEditor(e.editorContainer))}if(e.portal&&e.portal.destroy(),e.overlay){const t=e.overlay.querySelector(".widgetic-edit-button");t&&(t.style.display="block")}e.isOpen=!1,e.editorContainer=void 0,e.editorInstance=void 0,e.portal=void 0,n.info("Editor closed",{compositionId:t})}catch(e){n.error("Error closing editor",{compositionId:t,error:e})}}))}showError(e,t){const n=document.createElement("div");n.style.cssText="\n position: fixed;\n top: 20px;\n right: 20px;\n background: #dc3545;\n color: white;\n padding: 12px 16px;\n border-radius: 4px;\n z-index: 100001;\n font-size: 14px;\n max-width: 300px;\n ",n.textContent=e,document.body.appendChild(n),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n)}),5e3)}removeOverlay(e){const t=this.sessions.get(e);t&&(t.isOpen&&this.closeEditor(e),t.overlay&&t.overlay.parentNode&&t.overlay.parentNode.removeChild(t.overlay),t.portal&&t.portal.destroy(),this.sessions.delete(e),n.debug("Editor overlay removed",{compositionId:e}))}isEditorOpen(e){var t;return(null===(t=this.sessions.get(e))||void 0===t?void 0:t.isOpen)||!1}getActiveSessions(){return Array.from(this.sessions.keys())}cleanup(){for(const e of this.sessions.keys())this.removeOverlay(e);n.debug("Editor overlay cleanup complete")}}let Rn=null;function Tn(e){return Rn||(Rn=new In(e)),Rn}var qn=Object.freeze({__proto__:null,EditorOverlay:In,getEditorOverlay:Tn,resetEditorOverlay:function(){Rn&&(Rn.cleanup(),Rn=null)}});export{Qt as A,a as C,on as T,dn as W,tn as a,Tn as b,gn as c,yn as d,sn as e,ln as f,fn as g,Jt as h,qn as i,cn as t};