@widgetic/embed-sdk 0.0.0-stage → 2.0.6

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.
Files changed (89) hide show
  1. package/README.md +567 -2
  2. package/dist/browser/chunks/ABTestManager.js +1 -0
  3. package/dist/browser/chunks/advanced.js +1 -0
  4. package/dist/browser/chunks/api.js +1 -0
  5. package/dist/browser/chunks/core.js +1 -0
  6. package/dist/browser/chunks/display.js +1 -0
  7. package/dist/browser/chunks/media.js +1 -0
  8. package/dist/browser/chunks/messaging.js +1 -0
  9. package/dist/browser/chunks/performance.js +1 -0
  10. package/dist/browser/chunks/renderers.js +1 -0
  11. package/dist/browser/chunks/scanner.js +1 -0
  12. package/dist/browser/chunks/security.js +1 -0
  13. package/dist/browser/chunks/vendor.js +1 -0
  14. package/dist/browser/embed-bootstrap.js +1 -0
  15. package/dist/browser/embed-sdk.js +1 -0
  16. package/dist/esm/chunks/ABTestManager.js +1 -0
  17. package/dist/esm/chunks/advanced.js +1 -0
  18. package/dist/esm/chunks/api.js +1 -0
  19. package/dist/esm/chunks/core.js +1 -0
  20. package/dist/esm/chunks/display.js +1 -0
  21. package/dist/esm/chunks/media.js +1 -0
  22. package/dist/esm/chunks/messaging.js +1 -0
  23. package/dist/esm/chunks/performance.js +1 -0
  24. package/dist/esm/chunks/renderers.js +1 -0
  25. package/dist/esm/chunks/scanner.js +1 -0
  26. package/dist/esm/chunks/security.js +1 -0
  27. package/dist/esm/chunks/vendor.js +1 -0
  28. package/dist/esm/embed-bootstrap.js +1 -0
  29. package/dist/esm/embed-sdk.js +1 -0
  30. package/dist/esm/types/abTesting/ABTestElement.d.ts +120 -0
  31. package/dist/esm/types/abTesting/ABTestManager.d.ts +177 -0
  32. package/dist/esm/types/api/batch-client.d.ts +163 -0
  33. package/dist/esm/types/api/layers.d.ts +119 -0
  34. package/dist/esm/types/core/advanced-security-manager.d.ts +330 -0
  35. package/dist/esm/types/core/analytics-tracker.d.ts +224 -0
  36. package/dist/esm/types/core/auth-detector.d.ts +65 -0
  37. package/dist/esm/types/core/auth-manager.d.ts +90 -0
  38. package/dist/esm/types/core/autoscale-manager.d.ts +91 -0
  39. package/dist/esm/types/core/breakpoints.d.ts +48 -0
  40. package/dist/esm/types/core/config.d.ts +152 -0
  41. package/dist/esm/types/core/constants.d.ts +75 -0
  42. package/dist/esm/types/core/content-position-manager.d.ts +228 -0
  43. package/dist/esm/types/core/custom-element.d.ts +152 -0
  44. package/dist/esm/types/core/display-manager.d.ts +109 -0
  45. package/dist/esm/types/core/editor-overlay.d.ts +113 -0
  46. package/dist/esm/types/core/embed-sdk.d.ts +310 -0
  47. package/dist/esm/types/core/exit-intent-trigger.d.ts +114 -0
  48. package/dist/esm/types/core/lazy-loader.d.ts +111 -0
  49. package/dist/esm/types/core/media-manager.d.ts +364 -0
  50. package/dist/esm/types/core/messaging.d.ts +251 -0
  51. package/dist/esm/types/core/overlay-manager.d.ts +119 -0
  52. package/dist/esm/types/core/performance-monitor.d.ts +152 -0
  53. package/dist/esm/types/core/privacy-compliance.d.ts +236 -0
  54. package/dist/esm/types/core/realtime-manager.d.ts +279 -0
  55. package/dist/esm/types/core/resize-handler.d.ts +81 -0
  56. package/dist/esm/types/core/resource-optimizer.d.ts +133 -0
  57. package/dist/esm/types/core/responsive-manager.d.ts +49 -0
  58. package/dist/esm/types/core/scroll-trigger.d.ts +105 -0
  59. package/dist/esm/types/core/security-manager.d.ts +150 -0
  60. package/dist/esm/types/core/text-field-manager.d.ts +204 -0
  61. package/dist/esm/types/core/token-provider.d.ts +75 -0
  62. package/dist/esm/types/core/trigger-defaults.d.ts +36 -0
  63. package/dist/esm/types/core/trigger-manager.d.ts +248 -0
  64. package/dist/esm/types/core/types.d.ts +473 -0
  65. package/dist/esm/types/core/ui-sdk-loader.d.ts +90 -0
  66. package/dist/esm/types/core/widget-manager.d.ts +285 -0
  67. package/dist/esm/types/core/widget-metadata.d.ts +107 -0
  68. package/dist/esm/types/embed-sdk.d.ts +31 -0
  69. package/dist/esm/types/loaders/module-loader.d.ts +147 -0
  70. package/dist/esm/types/renderers/custom-element-renderer.d.ts +78 -0
  71. package/dist/esm/types/renderers/iframe-renderer.d.ts +185 -0
  72. package/dist/esm/types/renderers/widget-renderer.d.ts +173 -0
  73. package/dist/esm/types/sdk/embed-bootstrap.d.ts +84 -0
  74. package/dist/esm/types/sdk/embed-sdk.d.ts +31 -0
  75. package/dist/esm/types/translations/TranslationElement.d.ts +93 -0
  76. package/dist/esm/types/utils/browser.d.ts +29 -0
  77. package/dist/esm/types/utils/caseConversion.d.ts +2 -0
  78. package/dist/esm/types/utils/css-debug.d.ts +105 -0
  79. package/dist/esm/types/utils/device-detector.d.ts +100 -0
  80. package/dist/esm/types/utils/event-emitter.d.ts +14 -0
  81. package/dist/esm/types/utils/hydrate-published-host.d.ts +17 -0
  82. package/dist/esm/types/utils/logger.d.ts +31 -0
  83. package/dist/esm/types/utils/parser.d.ts +39 -0
  84. package/dist/esm/types/utils/portal.d.ts +74 -0
  85. package/dist/esm/types/utils/public-embed-lookup.d.ts +68 -0
  86. package/dist/esm/types/utils/published-host-display.d.ts +61 -0
  87. package/dist/umd/embed-bootstrap.js +1 -0
  88. package/dist/umd/embed-sdk.js +1 -0
  89. package/package.json +154 -4
@@ -0,0 +1 @@
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 s="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(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(r,a)}d((i=i.apply(e,t||[])).next())}))};const r="https://api.widgetic.com/v1".replace(/\/+$/,"");class a{constructor(e){if(this.configuration={basePath:r,headers:{},middleware:[]},"string"==typeof e){const t=(null==e?void 0:e.startsWith("Bearer "))?e.slice(7):e;this.configuration.apiKey=e=>s(this,void 0,void 0,(function*(){return"authorization"===(null==e?void 0:e.toLowerCase())?`Bearer ${t}`:t})),this.configuration.accessToken=()=>s(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||r});if("string"==typeof e.accessToken&&e.accessToken){const t=e.accessToken,n=t.startsWith("Bearer ")?t.slice(7):t;this.configuration.apiKey=e=>s(this,void 0,void 0,(function*(){return"authorization"===(null==e?void 0:e.toLowerCase())?`Bearer ${n}`:n})),this.configuration.accessToken=()=>s(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:r}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:()=>s(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)=>s(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 s(this,void 0,void 0,(function*(){var n;const{url:i,init:o}=yield this.createFetchParams(e,t),s=new Headers(Object.assign(Object.assign(Object.assign({},this.configuration.headers),e.headers||{}),o.headers||{})),r=Object.assign(Object.assign({},o),{headers:s}),a=yield this.fetchApi(i,r);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 s(this,void 0,void 0,(function*(){let n=(this.configuration.basePath||r).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:()=>s(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 v(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 s(this,void 0,void 0,(function*(){const e=yield this.raw.json();return this.transformer(this.unwrapSuccessEnvelope(e))}))}}class m{constructor(e){this.raw=e}value(){return s(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 R(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 I(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 k(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 q(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 A(e){return function(e){if(null==e)return e;return{overall:null==e.overall?void 0:k(e.overall),variants:null==e.variants?void 0:e.variants.map(q),recommendation:null==e.recommendation?void 0:T(e.recommendation)}}(e)}function C(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(C)}}(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 z(e){return function(e){if(null==e)return e;return{events:e.events.map(W)}}(e,!1)}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{canAccess:null==e.canAccess?void 0:e.canAccess,reason:null==e.reason?void 0:e.reason}}(e)}function j(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 $(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:j(e.data)}}(e)}function G(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,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}}(e)}function K(e){return function(e){if(null==e)return e;return{name:e.name,type:e.type}}(e)}function L(e){return function(e){if(null==e)return e;return{name:e.name,columns:e.columns.map(K),rows:e.rows}}(e)}function M(e){return function(e){if(null==e)return e;return{compositionId:e.compositionId,hasData:e.hasData,tables:e.tables.map(L)}}(e)}function N(e){return function(e){if(null==e)return e;return{value:e.value,count:e.count}}(e)}function V(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}}(e)}function F(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 H(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 J(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 Z(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(J),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 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:G(e.data)}}(e)}function X(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 Y(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 ee(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 te(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:Y(e.position),size:null==e.size?void 0:ee(e.size)}}(e)}function ne(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(te),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 ie(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:ne(e.data),meta:null==e.meta?void 0:e.meta}}(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:y(e.data)}}(e)}function se(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 re(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 ae(e){return function(e){if(null==e)return e;return{operationId:null==e.operationId?void 0:e.operationId}}(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:ae(e.data)}}(e)}function ue(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(te),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 le(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),warnings:null==e.warnings?void 0:e.warnings}}(e)}function ce(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 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:ce(e.data)}}(e)}function pe(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 fe(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(pe),success_metrics:null==e.success_metrics?void 0:e.success_metrics}}(e)}function ve(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 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.data.map(G),meta:null==e.meta?void 0:ve(e.meta)}}(e)}function me(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 we(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(me)}}(e)}function ye(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 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(ye)}}(e)}function Ie(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 Te(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 ke(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 qe(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 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:e.data.map(F)}}(e)}function Ce(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 be(e){return function(e){if(null==e)return e;return{compositions:null==e.compositions?void 0:e.compositions.map(G),errors:null==e.errors?void 0:e.errors.map(Ce)}}(e)}function Se(e){return function(e){if(null==e)return e;return{presets:null==e.presets?void 0:e.presets}}(e)}function Be(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)}}(e)}function Ee(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 _e(e){return function(e){if(null==e)return e;return{languages:null==e.languages?void 0:v(e.languages,Ee),preselected:null==e.preselected?void 0:e.preselected}}(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:_e(e.data)}}(e)}function Ue(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 Pe(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 We(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 ze(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(Pe),topPerformingLanguages:null==e.topPerformingLanguages?void 0:e.topPerformingLanguages.map(We),completionStatus:null==e.completionStatus?void 0:e.completionStatus}}(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:ze(e.data)}}(e)}function xe(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 je(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:xe(e.data)}}(e)}function $e(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 Ge(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 Ke(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 Le(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(Ke)}}(e)}function Me(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 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:e.data.map(ue),meta:null==e.meta?void 0:Me(e.meta)}}(e)}function Ve(e){return function(e){if(null==e)return e;return{widgets:null==e.widgets?void 0:e.widgets.map(ue),errors:null==e.errors?void 0:e.errors.map(Ce)}}(e)}function Fe(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 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:A(e.data)}}(e)}function Je(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 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(y),meta:null==e.meta?void 0:Je(e.meta)}}(e)}function Qe(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 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:e.data}}(e)}function Ye(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 et(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:Ye(e.data)}}(e)}function tt(e){return function(e){if(null==e)return e;return{email:e.email}}(e,!1)}function nt(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 it(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,validationResult:null==e.validationResult?void 0:nt(e.validationResult),compositionUpdated:null==e.compositionUpdated?void 0:e.compositionUpdated,realtimeUpdateSent:null==e.realtimeUpdateSent?void 0:e.realtimeUpdateSent}}(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,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 st(e){return function(e){if(null==e)return e;return{data:null==e.data?void 0:ot(e.data),message:null==e.message?void 0:e.message}}(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:st(e.data)}}(e)}function at(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 dt(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 ut(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 lt(e){return function(e){if(null==e)return e;return{pagination:null==e.pagination?void 0:ut(e.pagination)}}(e)}function ct(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:lt(e.meta)}}(e)}function ht(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 pt(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 ft(e){return function(e){if(null==e)return e;return{event_type:e.event_type,data:pt(e.data)}}(e,!1)}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,count:null==e.count?void 0:e.count}}(e)}function gt(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 mt(e){return function(e){if(null==e)return e;return{event_type:e.event_type,data:gt(e.data)}}(e,!1)}function wt(e){return function(e){if(null==e)return e;return{events:e.events.map(mt)}}(e,!1)}function yt(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 Rt(e){return function(e){if(null==e)return e;return{token:e.token,email:e.email}}(e,!1)}function It(e){return function(e){if(null==e)return e;return{repositoryId:null==e.repositoryId?void 0:e.repositoryId}}(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:It(e.data),meta:null==e.meta?void 0:e.meta}}(e)}function kt(e){return function(e){if(null==e)return e;return{thumbnailUrl:null==e.thumbnailUrl?void 0:e.thumbnailUrl}}(e)}function qt(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:kt(e.data)}}(e)}function At(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 Ct(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 bt(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 St(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:bt(e.data)}}(e)}function Bt(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 Et(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:Bt(e.data)}}(e)}function _t(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 Dt(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 Ut(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(Dt),warnings:null==e.warnings?void 0:e.warnings.map(_t)}}(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:Ut(e.data)}}(e)}function Wt(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 zt(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(Wt),recommendations:null==e.recommendations?void 0:e.recommendations}}(e)}function Ot(e){return function(e){if(null==e)return e;return{success:null==e.success?void 0:e.success,data:null==e.data?void 0:zt(e.data)}}(e)}function xt(e){return function(e){if(null==e)return e;return{composition_id:e.composition_id,name:e.name}}(e,!1)}function jt(e){return function(e){if(null==e)return e;return{variants:e.variants.map(xt),success_metrics:e.success_metrics}}(e,!1)}function $t(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(Dt),warnings:null==e.warnings?void 0:e.warnings.map(_t)}}(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 Kt(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 Lt="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(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(r,a)}d((i=i.apply(e,t||[])).next())}))};class Mt extends u{assignVariantRaw(e,t){return Lt(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"},i=yield this.request({path:"/ab-tests/{id}/assign".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(s=e.assignVariantRequest,o=s,null==o?o:{user_id:o.user_id,session_id:o.session_id})},t);var o,s;return new g(i,(e=>w(e)))}))}assignVariant(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.assignVariantRaw(e,t);return yield n.value()}))}checkWorkspaceABTestAutoStopRaw(e,t){return Lt(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=>$(e)))}))}checkWorkspaceABTestAutoStop(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.checkWorkspaceABTestAutoStopRaw(e,t);return yield n.value()}))}createABTestAssignmentRaw(e,t){return Lt(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"},i=yield this.request({path:"/ab-tests/assignments",method:"POST",headers:n,query:{},body:(s=e.createABTestAssignmentRequest,o=s,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,s;return new g(i,(e=>H(e)))}))}createABTestAssignment(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.createABTestAssignmentRaw(e,t);return yield n.value()}))}createWorkspaceABTestRaw(e,t){return Lt(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(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:Z(e.createABTestRequest)},t);return new g(i,(e=>oe(e)))}))}createWorkspaceABTest(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.createWorkspaceABTestRaw(e,t);return yield n.value()}))}deleteWorkspaceABTestRaw(e,t){return Lt(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=>re(e)))}))}deleteWorkspaceABTest(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.deleteWorkspaceABTestRaw(e,t);return yield n.value()}))}getABTestConfigRaw(e,t){return Lt(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=>fe(e)))}))}getABTestConfig(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.getABTestConfigRaw(e,t);return yield n.value()}))}getAvailableMetricsRaw(e){return Lt(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=>we(e)))}))}getAvailableMetrics(e){return Lt(this,void 0,void 0,(function*(){const t=yield this.getAvailableMetricsRaw(e);return yield t.value()}))}getAvailableSuccessMetricsRaw(e){return Lt(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=>Re(e)))}))}getAvailableSuccessMetrics(e){return Lt(this,void 0,void 0,(function*(){const t=yield this.getAvailableSuccessMetricsRaw(e);return yield t.value()}))}getVariantConfigRaw(e,t){return Lt(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=>Ge(e)))}))}getVariantConfig(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.getVariantConfigRaw(e,t);return yield n.value()}))}getWorkspaceABTestRaw(e,t){return Lt(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=>oe(e)))}))}getWorkspaceABTest(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.getWorkspaceABTestRaw(e,t);return yield n.value()}))}getWorkspaceABTestDiagnosisRaw(e,t){return Lt(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=>Fe(e)))}))}getWorkspaceABTestDiagnosis(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.getWorkspaceABTestDiagnosisRaw(e,t);return yield n.value()}))}getWorkspaceABTestStatisticsRaw(e,t){return Lt(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=>He(e)))}))}getWorkspaceABTestStatistics(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.getWorkspaceABTestStatisticsRaw(e,t);return yield n.value()}))}listWorkspaceABTestsRaw(e,t){return Lt(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=>Ze(e)))}))}listWorkspaceABTests(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.listWorkspaceABTestsRaw(e,t);return yield n.value()}))}pauseWorkspaceABTestRaw(e,t){return Lt(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(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=>oe(e)))}))}pauseWorkspaceABTest(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.pauseWorkspaceABTestRaw(e,t);return yield n.value()}))}setWorkspaceABTestDurationRaw(e,t){return Lt(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(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:(s=e.setWorkspaceABTestDurationRequest,o=s,null==o?o:{duration_days:o.duration_days})},t);var o,s;return new g(i,(e=>at(e)))}))}setWorkspaceABTestDuration(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.setWorkspaceABTestDurationRaw(e,t);return yield n.value()}))}startWorkspaceABTestRaw(e,t){return Lt(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(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=>oe(e)))}))}startWorkspaceABTest(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.startWorkspaceABTestRaw(e,t);return yield n.value()}))}stopWorkspaceABTestRaw(e,t){return Lt(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(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:(s=e.stopWorkspaceABTestRequest,o=s,null==o?o:{winning_variant_id:o.winning_variant_id,winningVariantId:o.winningVariantId})},t);var o,s;return new g(i,(e=>dt(e)))}))}stopWorkspaceABTest(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.stopWorkspaceABTestRaw(e,t);return yield n.value()}))}trackABTestEventRaw(e,t){return Lt(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"},i=yield this.request({path:"/ab-tests/analytics/events",method:"POST",headers:n,query:{},body:ft(e.trackABTestEventRequest)},t);return new g(i,(e=>ht(e)))}))}trackABTestEvent(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.trackABTestEventRaw(e,t);return yield n.value()}))}trackBulkABTestEventsRaw(e,t){return Lt(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"},i=yield this.request({path:"/ab-tests/analytics/bulk",method:"POST",headers:n,query:{},body:wt(e.trackBulkABTestEventsRequest)},t);return new g(i,(e=>vt(e)))}))}trackBulkABTestEvents(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.trackBulkABTestEventsRaw(e,t);return yield n.value()}))}updateWorkspaceABTestRaw(e,t){return Lt(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(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:yt(e.updateABTestRequest)},t);return new g(i,(e=>oe(e)))}))}updateWorkspaceABTest(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.updateWorkspaceABTestRaw(e,t);return yield n.value()}))}validateWorkspaceCompositionDeletionRaw(e,t){return Lt(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(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:(s=e.validateWorkspaceCompositionDeletionRequest,o=s,null==o?o:{composition_ids:o.composition_ids})},t);var o,s;return new g(i,(e=>Pt(e)))}))}validateWorkspaceCompositionDeletion(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.validateWorkspaceCompositionDeletionRaw(e,t);return yield n.value()}))}validateWorkspaceGoalTrackingRaw(e,t){return Lt(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(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:jt(e.validateWorkspaceGoalTrackingRequest)},t);return new g(i,(e=>Ot(e)))}))}validateWorkspaceGoalTracking(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.validateWorkspaceGoalTrackingRaw(e,t);return yield n.value()}))}validateWorkspaceWidgetDeletionRaw(e,t){return Lt(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(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:(s=e.validateWorkspaceWidgetDeletionRequest,o=s,null==o?o:{widget_id:o.widget_id})},t);var o,s;return new g(i,(e=>Gt(e)))}))}validateWorkspaceWidgetDeletion(e,t){return Lt(this,void 0,void 0,(function*(){const n=yield this.validateWorkspaceWidgetDeletionRaw(e,t);return yield n.value()}))}}var Nt="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(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(r,a)}d((i=i.apply(e,t||[])).next())}))};class Vt extends u{analyticsEventsBulkPostRaw(e,t){return Nt(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:z(e.analyticsEventsBulkPostRequest)},t);return new g(i,(e=>e.map(D)))}))}analyticsEventsBulkPost(e,t){return Nt(this,void 0,void 0,(function*(){const n=yield this.analyticsEventsBulkPostRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsDailyGetRaw(e,t){return Nt(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(se)))}))}compositionsIdAnalyticsDailyGet(e,t){return Nt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsDailyGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsDashboardGetRaw(e,t){return Nt(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 Nt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsDashboardGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsDevicesGetRaw(e,t){return Nt(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 Nt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsDevicesGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsEventsGetRaw(e,t){return Nt(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 Nt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsEventsGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsEventsPostRaw(e,t){return Nt(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 Nt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsEventsPostRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsGeographyGetRaw(e,t){return Nt(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 Nt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsGeographyGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsMonthlyGetRaw(e,t){return Nt(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(Qe)))}))}compositionsIdAnalyticsMonthlyGet(e,t){return Nt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsMonthlyGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsReferrersGetRaw(e,t){return Nt(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 Nt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsReferrersGetRaw(e,t);return yield n.value()}))}compositionsIdAnalyticsWeeklyGetRaw(e,t){return Nt(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(Kt)))}))}compositionsIdAnalyticsWeeklyGet(e,t){return Nt(this,void 0,void 0,(function*(){const n=yield this.compositionsIdAnalyticsWeeklyGetRaw(e,t);return yield n.value()}))}flushAxiomEventsRaw(e){return Nt(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=>ct(e)))}))}flushAxiomEvents(e){return Nt(this,void 0,void 0,(function*(){const t=yield this.flushAxiomEventsRaw(e);return yield t.value()}))}getAxiomStatusRaw(e){return Nt(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=>ct(e)))}))}getAxiomStatus(e){return Nt(this,void 0,void 0,(function*(){const t=yield this.getAxiomStatusRaw(e);return yield t.value()}))}}var Ft="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(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(r,a)}d((i=i.apply(e,t||[])).next())}))};class Ht extends u{completeSignupRaw(e,t){return Ft(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"},i=yield this.request({path:"/auth/complete-signup",method:"POST",headers:n,query:{},body:(s=e.completeSignupRequest,o=s,null==o?o:{userId:o.userId,email:o.email,role:o.role,plan:o.plan,token:o.token})},t);var o,s;return new m(i)}))}completeSignup(e,t){return Ft(this,void 0,void 0,(function*(){yield this.completeSignupRaw(e,t)}))}confirmEmailRaw(e,t){return Ft(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:Rt(e.updateEmailRequest)},t);return new m(i)}))}confirmEmail(e,t){return Ft(this,void 0,void 0,(function*(){yield this.confirmEmailRaw(e,t)}))}consumeOAuthSessionBridgeRaw(e,t){return Ft(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 m(n)}))}consumeOAuthSessionBridge(e,t){return Ft(this,void 0,void 0,(function*(){yield this.consumeOAuthSessionBridgeRaw(e,t)}))}deleteAccountRaw(e,t){return Ft(this,void 0,void 0,(function*(){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/delete-account",method:"POST",headers:n,query:{},body:(s=e.deleteAccountRequest,o=s,null==o?o:{password:o.password})},t);var o,s;return new m(i)}))}deleteAccount(){return Ft(this,arguments,void 0,(function*(e={},t){yield this.deleteAccountRaw(e,t)}))}getSessionRaw(e){return Ft(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 m(n)}))}getSession(e){return Ft(this,void 0,void 0,(function*(){yield this.getSessionRaw(e)}))}getUserMetadataRaw(e){return Ft(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 m(n)}))}getUserMetadata(e){return Ft(this,void 0,void 0,(function*(){yield this.getUserMetadataRaw(e)}))}initiateOAuthRaw(e,t){return Ft(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 m(i)}))}initiateOAuth(e,t){return Ft(this,void 0,void 0,(function*(){yield this.initiateOAuthRaw(e,t)}))}loginUserRaw(e,t){return Ft(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:(s=e.loginUserRequest,o=s,null==o?o:{email:o.email,password:o.password})},t);var o,s;return new g(i,(e=>Xe(e)))}))}loginUser(e,t){return Ft(this,void 0,void 0,(function*(){const n=yield this.loginUserRaw(e,t);return yield n.value()}))}logoutUserRaw(e){return Ft(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 m(n)}))}logoutUser(e){return Ft(this,void 0,void 0,(function*(){yield this.logoutUserRaw(e)}))}refreshSessionRaw(e,t){return Ft(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:(s=e.refreshSessionRequest,o=s,null==o?o:{refresh_token:o.refresh_token})},t);var o,s;return new m(i)}))}refreshSession(e,t){return Ft(this,void 0,void 0,(function*(){yield this.refreshSessionRaw(e,t)}))}resendConfirmationRaw(e,t){return Ft(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"},i=yield this.request({path:"/auth/resend-confirmation",method:"POST",headers:n,query:{},body:tt(e.resetPasswordRequest)},t);return new m(i)}))}resendConfirmation(e,t){return Ft(this,void 0,void 0,(function*(){yield this.resendConfirmationRaw(e,t)}))}resetPasswordRaw(e,t){return Ft(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"},i=yield this.request({path:"/auth/reset-password",method:"POST",headers:n,query:{},body:tt(e.resetPasswordRequest)},t);return new m(i)}))}resetPassword(e,t){return Ft(this,void 0,void 0,(function*(){yield this.resetPasswordRaw(e,t)}))}signupUserRaw(e,t){return Ft(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"},i=yield this.request({path:"/auth/signup",method:"POST",headers:n,query:{},body:(s=e.signupUserRequest,o=s,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,s;return new m(i)}))}signupUser(e,t){return Ft(this,void 0,void 0,(function*(){yield this.signupUserRaw(e,t)}))}signupWithInvitationRaw(e,t){return Ft(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"},i=yield this.request({path:"/auth/signup-with-invitation",method:"POST",headers:n,query:{},body:(s=e.signupWithInvitationRequest,o=s,null==o?o:{email:o.email,password:o.password,role:o.role,plan:o.plan,invitationId:o.invitationId,organizationId:o.organizationId})},t);var o,s;return new m(i)}))}signupWithInvitation(e,t){return Ft(this,void 0,void 0,(function*(){yield this.signupWithInvitationRaw(e,t)}))}updateEmailRaw(e,t){return Ft(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"},i=yield this.request({path:"/auth/update-email",method:"POST",headers:n,query:{},body:Rt(e.updateEmailRequest)},t);return new m(i)}))}updateEmail(e,t){return Ft(this,void 0,void 0,(function*(){yield this.updateEmailRaw(e,t)}))}updateNameRaw(e,t){return Ft(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:(s=e.updateNameRequest,o=s,null==o?o:{token:o.token,name:o.name})},t);var o,s;return new m(i)}))}updateName(e,t){return Ft(this,void 0,void 0,(function*(){yield this.updateNameRaw(e,t)}))}updatePasswordRaw(e,t){return Ft(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"},i=yield this.request({path:"/auth/update-password",method:"POST",headers:n,query:{},body:(s=e.updatePasswordRequest,o=s,null==o?o:{token:o.token,email:o.email,password:o.password})},t);var o,s;return new m(i)}))}updatePassword(e,t){return Ft(this,void 0,void 0,(function*(){yield this.updatePasswordRaw(e,t)}))}updateUserMetadataRaw(e,t){return Ft(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:(s=e.updateUserMetadataRequest,o=s,null==o?o:{metadata:o.metadata})},t);var o,s;return new m(i)}))}updateUserMetadata(e,t){return Ft(this,void 0,void 0,(function*(){yield this.updateUserMetadataRaw(e,t)}))}validateInviteCodeRaw(e,t){return Ft(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=>St(e)))}))}validateInviteCode(e,t){return Ft(this,void 0,void 0,(function*(){const n=yield this.validateInviteCodeRaw(e,t);return yield n.value()}))}}var Jt="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(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(r,a)}d((i=i.apply(e,t||[])).next())}))};class Zt extends u{checkCompositionAccessRaw(e,t){return Jt(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=>O(e)))}))}checkCompositionAccess(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.checkCompositionAccessRaw(e,t);return yield n.value()}))}createCompositionRaw(e,t){return Jt(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(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:(s=e.newComposition,o=s,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,s;return new g(i,(e=>Q(e)))}))}createComposition(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.createCompositionRaw(e,t);return yield n.value()}))}createCompositionDatabaseRecordRaw(e,t){return Jt(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(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 m(i)}))}createCompositionDatabaseRecord(e,t){return Jt(this,void 0,void 0,(function*(){yield this.createCompositionDatabaseRecordRaw(e,t)}))}deleteCompositionRaw(e,t){return Jt(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 m(i)}))}deleteComposition(e,t){return Jt(this,void 0,void 0,(function*(){yield this.deleteCompositionRaw(e,t)}))}deleteCompositionDatabaseRecordRaw(e,t){return Jt(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 m(i)}))}deleteCompositionDatabaseRecord(e,t){return Jt(this,void 0,void 0,(function*(){yield this.deleteCompositionDatabaseRecordRaw(e,t)}))}describeCompositionEntriesRaw(e,t){return Jt(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=>M(e)))}))}describeCompositionEntries(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.describeCompositionEntriesRaw(e,t);return yield n.value()}))}duplicateCompositionRaw(e,t){return Jt(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(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:(s=e.duplicateCompositionRequest,o=s,null==o?o:{name:o.name,includeDatabase:o.includeDatabase})},t);var o,s;return new g(i,(e=>de(e)))}))}duplicateComposition(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.duplicateCompositionRaw(e,t);return yield n.value()}))}getAllCompositionsRaw(e,t){return Jt(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=>ge(e)))}))}getAllCompositions(){return Jt(this,arguments,void 0,(function*(e={},t){const n=yield this.getAllCompositionsRaw(e,t);return yield n.value()}))}getCompositionByIdRaw(e,t){return Jt(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=>Q(e)))}))}getCompositionById(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionByIdRaw(e,t);return yield n.value()}))}getCompositionContentRaw(e,t){return Jt(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 Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionContentRaw(e,t);return yield n.value()}))}getCompositionContentSchemaRaw(e,t){return Jt(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=>Ie(e)))}))}getCompositionContentSchema(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionContentSchemaRaw(e,t);return yield n.value()}))}getCompositionDatabaseRecordRaw(e,t){return Jt(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 m(i)}))}getCompositionDatabaseRecord(e,t){return Jt(this,void 0,void 0,(function*(){yield this.getCompositionDatabaseRecordRaw(e,t)}))}getCompositionDatabaseRecordsRaw(e,t){return Jt(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 m(i)}))}getCompositionDatabaseRecords(e,t){return Jt(this,void 0,void 0,(function*(){yield this.getCompositionDatabaseRecordsRaw(e,t)}))}getCompositionDesignRaw(e,t){return Jt(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 Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionDesignRaw(e,t);return yield n.value()}))}getCompositionDesignSchemaRaw(e,t){return Jt(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=>Te(e)))}))}getCompositionDesignSchema(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionDesignSchemaRaw(e,t);return yield n.value()}))}getCompositionEmbedSchemaRaw(e,t){return Jt(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=>ke(e)))}))}getCompositionEmbedSchema(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionEmbedSchemaRaw(e,t);return yield n.value()}))}getCompositionEmbedSettingsRaw(e,t){return Jt(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 Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionEmbedSettingsRaw(e,t);return yield n.value()}))}getCompositionPreviewRaw(e,t){return Jt(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=>qe(e)))}))}getCompositionPreview(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionPreviewRaw(e,t);return yield n.value()}))}getCompositionVersionsRaw(e,t){return Jt(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=>Ae(e)))}))}getCompositionVersions(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionVersionsRaw(e,t);return yield n.value()}))}getCompositionsBatchRaw(e,t){return Jt(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:(s=e.getCompositionsBatchRequest,o=s,null==o?o:{compositionIds:o.compositionIds})},t);var o,s;return new g(i,(e=>be(e)))}))}getCompositionsBatch(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.getCompositionsBatchRaw(e,t);return yield n.value()}))}readCompositionEntriesRaw(e,t){return Jt(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);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=>V(e)))}))}readCompositionEntries(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.readCompositionEntriesRaw(e,t);return yield n.value()}))}setDynamicContentRaw(e,t){return Jt(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(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:(s=e.setDynamicContentRequest,o=s,null==o?o:{content:o.content,validate:o.validate,partial:o.partial,version:o.version,source:o.source})},t);var o,s;return new g(i,(e=>it(e)))}))}setDynamicContent(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.setDynamicContentRaw(e,t);return yield n.value()}))}updateCompositionRaw(e,t){return Jt(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(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:(s=e.updateComposition,o=s,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,s;return new g(i,(e=>Q(e)))}))}updateComposition(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.updateCompositionRaw(e,t);return yield n.value()}))}updateCompositionDatabaseRecordRaw(e,t){return Jt(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(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 m(i)}))}updateCompositionDatabaseRecord(e,t){return Jt(this,void 0,void 0,(function*(){yield this.updateCompositionDatabaseRecordRaw(e,t)}))}updateCompositionStatusRaw(e,t){return Jt(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(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:(s=e.updateCompositionStatusRequest,o=s,null==o?o:{status:o.status})},t);var o,s;return new g(i,(e=>G(e)))}))}updateCompositionStatus(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.updateCompositionStatusRaw(e,t);return yield n.value()}))}validateCompositionContentRaw(e,t){return Jt(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(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=>Ct(e)))}))}validateCompositionContent(e,t){return Jt(this,void 0,void 0,(function*(){const n=yield this.validateCompositionContentRaw(e,t);return yield n.value()}))}}var Qt="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(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(r,a)}d((i=i.apply(e,t||[])).next())}))};class Xt extends u{exchangeTokenRaw(e,t){return Qt(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:(s=e.exchangeTokenRequest,o=s,null==o?o:{scopes:o.scopes,expiresIn:o.expiresIn})},t);var o,s;return new g(i,(e=>he(e)))}))}exchangeToken(e,t){return Qt(this,void 0,void 0,(function*(){const n=yield this.exchangeTokenRaw(e,t);return yield n.value()}))}validateTokenRaw(e){return Qt(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=>Et(e)))}))}validateToken(e){return Qt(this,void 0,void 0,(function*(){const t=yield this.validateTokenRaw(e);return yield t.value()}))}}var Yt="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(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(r,a)}d((i=i.apply(e,t||[])).next())}))};class en extends u{addLanguagesToTranslationRaw(e,t){return Yt(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(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:(s=e.addLanguagesToTranslationRequest,o=s,null==o?o:{languages:o.languages})},t);var o,s;return new g(i,(e=>S(e)))}))}addLanguagesToTranslation(e,t){return Yt(this,void 0,void 0,(function*(){const n=yield this.addLanguagesToTranslationRaw(e,t);return yield n.value()}))}createTranslationRaw(e,t){return Yt(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(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:(s=e.createTranslationRequest,o=s,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,s;return new g(i,(e=>X(e)))}))}createTranslation(e,t){return Yt(this,void 0,void 0,(function*(){const n=yield this.createTranslationRaw(e,t);return yield n.value()}))}deleteTranslationRaw(e,t){return Yt(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=>At(e)))}))}deleteTranslation(e,t){return Yt(this,void 0,void 0,(function*(){const n=yield this.deleteTranslationRaw(e,t);return yield n.value()}))}getLanguagePresetsRaw(e){return Yt(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=>Be(e)))}))}getLanguagePresets(e){return Yt(this,void 0,void 0,(function*(){const t=yield this.getLanguagePresetsRaw(e);return yield t.value()}))}getSupportedLanguagesRaw(e){return Yt(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=>De(e)))}))}getSupportedLanguages(e){return Yt(this,void 0,void 0,(function*(){const t=yield this.getSupportedLanguagesRaw(e);return yield t.value()}))}getTranslationRaw(e,t){return Yt(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=>Ue(e)))}))}getTranslation(e,t){return Yt(this,void 0,void 0,(function*(){const n=yield this.getTranslationRaw(e,t);return yield n.value()}))}getTranslationAnalyticsRaw(e,t){return Yt(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=>Oe(e)))}))}getTranslationAnalytics(e,t){return Yt(this,void 0,void 0,(function*(){const n=yield this.getTranslationAnalyticsRaw(e,t);return yield n.value()}))}getTranslationConfigRaw(e,t){return Yt(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=>je(e)))}))}getTranslationConfig(e,t){return Yt(this,void 0,void 0,(function*(){const n=yield this.getTranslationConfigRaw(e,t);return yield n.value()}))}getTranslationsRaw(e,t){return Yt(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=>$e(e)))}))}getTranslations(){return Yt(this,arguments,void 0,(function*(e={},t){const n=yield this.getTranslationsRaw(e,t);return yield n.value()}))}removeLanguageFromTranslationRaw(e,t){return Yt(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 Yt(this,void 0,void 0,(function*(){const n=yield this.removeLanguageFromTranslationRaw(e,t);return yield n.value()}))}retranslateExperimentRaw(e,t){return Yt(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(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:(s=e.retranslateExperimentRequest,o=s,null==o?o:{languages:o.languages})},t);var o,s;return new g(i,(e=>At(e)))}))}retranslateExperiment(e,t){return Yt(this,void 0,void 0,(function*(){const n=yield this.retranslateExperimentRaw(e,t);return yield n.value()}))}submitTranslationAnalyticsEventRaw(e,t){return Yt(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"},i=yield this.request({path:"/translations/{id}/analytics/events".replace("{id}",encodeURIComponent(String(e.id))),method:"POST",headers:n,query:{},body:(s=e.submitTranslationAnalyticsEventRequest,o=s,null==o?o:{eventType:o.eventType,language:o.language,compositionId:o.compositionId,metadata:o.metadata})},t);var o,s;return new m(i)}))}submitTranslationAnalyticsEvent(e,t){return Yt(this,void 0,void 0,(function*(){yield this.submitTranslationAnalyticsEventRaw(e,t)}))}updateTranslationStatusRaw(e,t){return Yt(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(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:(s=e.updateTranslationStatusRequest,o=s,null==o?o:{status:o.status})},t);var o,s;return new g(i,(e=>S(e)))}))}updateTranslationStatus(e,t){return Yt(this,void 0,void 0,(function*(){const n=yield this.updateTranslationStatusRaw(e,t);return yield n.value()}))}}var tn="undefined"!=typeof window&&window.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(o,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(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(r,a)}d((i=i.apply(e,t||[])).next())}))};class nn extends u{checkWidgetAccessRaw(e,t){return tn(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=>x(e)))}))}checkWidgetAccess(e,t){return tn(this,void 0,void 0,(function*(){const n=yield this.checkWidgetAccessRaw(e,t);return yield n.value()}))}createWidgetRaw(e,t){return tn(this,void 0,void 0,(function*(){if(null==e.idempotencyKey)throw new h("idempotencyKey",'Required parameter "idempotencyKey" was null or undefined when calling createWidget().');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:(s=e.newWidget,o=s,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,s;return new g(i,(e=>ie(e)))}))}createWidget(e,t){return tn(this,void 0,void 0,(function*(){const n=yield this.createWidgetRaw(e,t);return yield n.value()}))}deleteWidgetRaw(e,t){return tn(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:(s=e.deleteWidgetRequest,o=s,null==o?o:{reason:o.reason})},t);var o,s;return new m(i)}))}deleteWidget(e,t){return tn(this,void 0,void 0,(function*(){yield this.deleteWidgetRaw(e,t)}))}detachWidgetRaw(e,t){return tn(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 m(i)}))}detachWidget(e,t){return tn(this,void 0,void 0,(function*(){yield this.detachWidgetRaw(e,t)}))}duplicateWidgetRaw(e,t){return tn(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(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:(s=e.duplicateWidgetRequest,o=s,null==o?o:{name:o.name,canvas_id:o.canvas_id,managedUserId:o.managedUserId,managedUserExternalId:o.managedUserExternalId})},t);var o,s;return new g(i,(e=>le(e)))}))}duplicateWidget(e,t){return tn(this,void 0,void 0,(function*(){const n=yield this.duplicateWidgetRaw(e,t);return yield n.value()}))}getWidgetContentSchemaRaw(e,t){return tn(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 tn(this,void 0,void 0,(function*(){const n=yield this.getWidgetContentSchemaRaw(e,t);return yield n.value()}))}getWidgetDesignSchemaRaw(e,t){return tn(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 tn(this,void 0,void 0,(function*(){const n=yield this.getWidgetDesignSchemaRaw(e,t);return yield n.value()}))}getWidgetPublishHistoryRaw(e,t){return tn(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=>Le(e)))}))}getWidgetPublishHistory(e,t){return tn(this,void 0,void 0,(function*(){const n=yield this.getWidgetPublishHistoryRaw(e,t);return yield n.value()}))}getWidgetsRaw(e,t){return tn(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=>Ne(e)))}))}getWidgets(){return tn(this,arguments,void 0,(function*(e={},t){const n=yield this.getWidgetsRaw(e,t);return yield n.value()}))}getWidgetsBatchRaw(e,t){return tn(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:(s=e.getWidgetsBatchRequest,o=s,null==o?o:{widgetIds:o.widgetIds})},t);var o,s;return new g(i,(e=>Ve(e)))}))}getWidgetsBatch(e,t){return tn(this,void 0,void 0,(function*(){const n=yield this.getWidgetsBatchRaw(e,t);return yield n.value()}))}renameWidgetPublishHistoryTitleRaw(e,t){return tn(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:(s=e.renameWidgetPublishHistoryTitleRequest,o=s,null==o?o:{commitTitle:o.commitTitle})},t);var o,s;return new g(i,(e=>et(e)))}))}renameWidgetPublishHistoryTitle(e,t){return tn(this,void 0,void 0,(function*(){const n=yield this.renameWidgetPublishHistoryTitleRaw(e,t);return yield n.value()}))}setWidgetPublishHistoryLiveRaw(e,t){return tn(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=>rt(e)))}))}setWidgetPublishHistoryLive(e,t){return tn(this,void 0,void 0,(function*(){const n=yield this.setWidgetPublishHistoryLiveRaw(e,t);return yield n.value()}))}updateWidgetRaw(e,t){return tn(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:(s=e.updateWidgetRequest,o=s,null==o?o:{name:o.name,description:o.description,canvasId:o.canvasId,projectId:o.projectId,projectFolder:o.projectFolder})},t);var o,s;return new m(i)}))}updateWidget(e,t){return tn(this,void 0,void 0,(function*(){yield this.updateWidgetRaw(e,t)}))}updateWidgetRepositoryRaw(e,t){return tn(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:(s=e.updateWidgetRepositoryRequest,o=s,null==o?o:{repositoryId:o.repositoryId})},t);var o,s;return new g(i,(e=>Tt(e)))}))}updateWidgetRepository(e,t){return tn(this,void 0,void 0,(function*(){const n=yield this.updateWidgetRepositoryRaw(e,t);return yield n.value()}))}uploadWidgetThumbnailRaw(e,t){return tn(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:(s=e.uploadWidgetThumbnailRequest,o=s,null==o?o:{imageDataUrl:o.imageDataUrl})},t);var o,s;return new g(i,(e=>qt(e)))}))}uploadWidgetThumbnail(e,t){return tn(this,void 0,void 0,(function*(){const n=yield this.uploadWidgetThumbnailRaw(e,t);return yield n.value()}))}}const on=e=>null!==e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"===Object.prototype.toString.call(e);function sn(e){if(Array.isArray(e))return e.map(sn);if(!on(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(sn):on(i)?sn(i):i}return t}function rn(e){if(Array.isArray(e))return e.map(rn);if(!on(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(rn):on(i)?rn(i):i}return t}class an{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 Ht(n),this.compositionsApi=new Zt(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=sn(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 s=sn(yield this.compositionsApi.getCompositionById({id:t}));if(!s){const e={isOwner:!1,canEdit:!1,error:"Composition not found"};return this.ownershipCache.set(t,e),e}const r=s.creatorId===o.session.user.id,a={isOwner:r,canEdit:r,composition:s,error:r?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:r,userId:o.session.user.id,compositionCreatorId:s.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 dn=null;function un(){return dn||(dn=new an),dn}class ln{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 cn(e){return new ln(e)}class hn{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 pn=null;function fn(e){return pn||(pn=new hn(e)),pn}class vn{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=un(),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 s=t.parentElement;if(s){"static"===window.getComputedStyle(s).position&&(s.style.position="relative"),s.appendChild(e)}else t.style.position="relative",t.appendChild(e);const r={compositionId:i,isOpen:!1,overlay:e};this.sessions.set(i,r),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 ln({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=fn(),s=yield i.initializeUISdk(),{container:r,portal:a}=this.createEditorContainer(),d=yield s.mountCompositionEditor(r.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=r,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=fn().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 gn=null;function mn(e){return gn||(gn=new vn(e)),gn}var wn=Object.freeze({__proto__:null,EditorOverlay:vn,getEditorOverlay:mn,resetEditorOverlay:function(){gn&&(gn.cleanup(),gn=null)}});export{Vt as A,a as C,Xt as T,nn as W,Zt as a,mn as b,cn as c,fn as d,en as e,sn as f,un as g,Mt as h,wn as i,rn as t};