@spiffcommerce/core 44.7.2-alpha.0 → 44.7.2-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-BdOwb10s.js → index-B5i__ezk.js} +1174 -1160
- package/dist/index-B5i__ezk.js.map +1 -0
- package/dist/{index-DAas0pw7.cjs → index-Bhi8tgte.cjs} +87 -84
- package/dist/{index-BdOwb10s.js.map → index-Bhi8tgte.cjs.map} +1 -1
- package/dist/{index.browser-DDw6AnVr.cjs → index.browser-1pbIT4ky.cjs} +2 -2
- package/dist/{index.browser-DDw6AnVr.cjs.map → index.browser-1pbIT4ky.cjs.map} +1 -1
- package/dist/{index.browser-BBJl6VJx.js → index.browser-DkOdjJTT.js} +2 -2
- package/dist/{index.browser-BBJl6VJx.js.map → index.browser-DkOdjJTT.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/index-DAas0pw7.cjs.map +0 -1
|
@@ -52,7 +52,7 @@ spurious results.`)}}return!1};class Q2{constructor(e,t="GraphQL request",n={lin
|
|
|
52
52
|
`)),`
|
|
53
53
|
}`)}function Zt(r,e,t=""){return e!=null&&e!==""?r+e+t:""}function _p(r){return Zt(" ",r.replace(/\n/g,`
|
|
54
54
|
`))}function r0(r){var e;return(e=r?.some(t=>t.includes(`
|
|
55
|
-
`)))!==null&&e!==void 0?e:!1}function Cw(r){return r.kind===et.FIELD||r.kind===et.FRAGMENT_SPREAD||r.kind===et.INLINE_FRAGMENT}function Bf(r,e){var t=r.directives;return!t||!t.length?!0:bR(t).every(function(n){var i=n.directive,a=n.ifArgument,s=!1;return a.value.kind==="Variable"?(s=e&&e[a.value.name.value],Mr(s!==void 0,105,i.name.value)):s=a.value.value,i.name.value==="skip"?!s:s})}function df(r,e,t){var n=new Set(r),i=n.size;return Da(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return UA}}),t?!n.size:n.size<i}function vR(r){return r&&df(["client","export"],r,!0)}function AR(r){var e=r.name.value;return e==="skip"||e==="include"}function bR(r){var e=[];return r&&r.length&&r.forEach(function(t){if(AR(t)){var n=t.arguments,i=t.name.value;Mr(n&&n.length===1,106,i);var a=n[0];Mr(a.name&&a.name.value==="if",107,i);var s=a.value;Mr(s&&(s.kind==="Variable"||s.kind==="BooleanValue"),108,i),e.push({directive:t,ifArgument:a})}}),e}function wR(r){var e,t,n=(e=r.directives)===null||e===void 0?void 0:e.find(function(a){var s=a.name;return s.value==="unmask"});if(!n)return"mask";var i=(t=n.arguments)===null||t===void 0?void 0:t.find(function(a){var s=a.name;return s.value==="mode"});return i&&"value"in i.value&&i.value.value==="migrate"?"migrate":"unmask"}const xR=()=>Object.create(null),{forEach:CR,slice:Sw}=Array.prototype,{hasOwnProperty:SR}=Object.prototype;class Ls{constructor(e=!0,t=xR){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return CR.call(e,n=>t=t.getChildTrie(n)),SR.call(t,"data")?t.data:t.data=this.makeData(Sw.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=t.mapFor(e[n],!1);t=a&&a.get(e[n])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const n=e[0],i=this.mapFor(n,!1),a=i&&i.get(n);a&&(t=a.removeArray(Sw.call(e,1)),!a.data&&!a.weak&&!(a.strong&&a.strong.size)&&i.delete(n))}else t=this.data,delete this.data;return t}getChildTrie(e){const t=this.mapFor(e,!0);let n=t.get(e);return n||t.set(e,n=new Ls(this.weakness,this.makeData)),n}mapFor(e,t){return this.weakness&&ER(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}}function ER(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var kR=Ia(function(){return navigator.product})=="ReactNative",Dl=typeof WeakMap=="function"&&!(kR&&!global.HermesInternal),VA=typeof WeakSet=="function",J2=typeof Symbol=="function"&&typeof Symbol.for=="function",Rg=J2&&Symbol.asyncIterator;Ia(function(){return window.document.createElement});Ia(function(){return navigator.userAgent.indexOf("jsdom")>=0});function ci(r){return r!==null&&typeof r=="object"}function K2(r){return r!==null&&typeof r=="object"&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function TR(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw qi(112,a.operation,a.name?" named '".concat(a.name.value,"'"):"");a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(Mr(n.length===1,113,n.length),t=n[0].name.value);var i=me(me({},r),{definitions:na([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function uc(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Og(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var n=e&&e[t];return Mr(n,114,t),n||null}default:return null}}function FR(){}class mv{constructor(e=1/0,t=FR){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1}}function yv(){}const IR=yv,PR=typeof WeakRef<"u"?WeakRef:function(r){return{deref:()=>r}},DR=typeof WeakMap<"u"?WeakMap:Map,RR=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:yv,unregister:yv}},OR=10024;class ff{constructor(e=1/0,t=IR){this.max=e,this.dispose=t,this.map=new DR,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const n=this.unfinalizedNodes.values();for(let i=0;i<OR;i++){const a=n.next().value;if(!a)break;this.unfinalizedNodes.delete(a);const s=a.key;delete a.key,a.keyRef=new PR(s),this.registry.register(s,a,a)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new RR(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.scheduleFinalization(n),this.map.set(e,n),this.size++,n.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){const t=this.map.get(e);return t?(this.deleteNode(t),!0):!1}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}var n0=new WeakSet;function Z2(r){r.size<=(r.max||-1)||n0.has(r)||(n0.add(r),setTimeout(function(){r.clean(),n0.delete(r)},100))}var ek=function(r,e){var t=new ff(r,e);return t.set=function(n,i){var a=ff.prototype.set.call(this,n,i);return Z2(this),a},t},BR=function(r,e){var t=new mv(r,e);return t.set=function(n,i){var a=mv.prototype.set.call(this,n,i);return Z2(this),a},t},MR=Symbol.for("apollo.cacheSize"),Ns=me({},sg[MR]),vo=Object.assign(function(e){return JSON.stringify(e,_R)},{reset:function(){Bd=new BR(Ns.canonicalStringify||1e3)}}),Bd;vo.reset();function _R(r,e){if(e&&typeof e=="object"){var t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null){var n=Object.keys(e);if(n.every(NR))return e;var i=JSON.stringify(n),a=Bd.get(i);if(!a){n.sort();var s=JSON.stringify(n);a=Bd.get(s)||n,Bd.set(i,a),Bd.set(s,a)}var o=Object.create(t);return a.forEach(function(l){o[l]=e[l]}),o}}return e}function NR(r,e,t){return e===0||t[e-1]<=r}function zu(r){return{__ref:String(r)}}function Fn(r){return!!(r&&typeof r=="object"&&typeof r.__ref=="string")}function LR(r){return ci(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function UR(r){return r.kind==="StringValue"}function VR(r){return r.kind==="BooleanValue"}function $R(r){return r.kind==="IntValue"}function zR(r){return r.kind==="FloatValue"}function HR(r){return r.kind==="Variable"}function GR(r){return r.kind==="ObjectValue"}function jR(r){return r.kind==="ListValue"}function qR(r){return r.kind==="EnumValue"}function WR(r){return r.kind==="NullValue"}function Yu(r,e,t,n){if($R(t)||zR(t))r[e.value]=Number(t.value);else if(VR(t)||UR(t))r[e.value]=t.value;else if(GR(t)){var i={};t.fields.map(function(s){return Yu(i,s.name,s.value,n)}),r[e.value]=i}else if(HR(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(jR(t))r[e.value]=t.values.map(function(s){var o={};return Yu(o,e,s,n),o[e.value]});else if(qR(t))r[e.value]=t.value;else if(WR(t))r[e.value]=null;else throw qi(123,e.value,t.kind)}function QR(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(i){t[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var s=a.name,o=a.value;return Yu(t[i.name.value],s,o,e)})}));var n=null;return r.arguments&&r.arguments.length&&(n={},r.arguments.forEach(function(i){var a=i.name,s=i.value;return Yu(n,a,s,e)})),tk(r.name.value,n,t)}var YR=["connection","include","skip","client","rest","export","nonreactive"],nd=vo,tk=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var n=t.connection.filter?t.connection.filter:[];n.sort();var i={};return n.forEach(function(o){i[o]=e[o]}),"".concat(t.connection.key,"(").concat(nd(i),")")}else return t.connection.key;var a=r;if(e){var s=nd(e);a+="(".concat(s,")")}return t&&Object.keys(t).forEach(function(o){YR.indexOf(o)===-1&&(t[o]&&Object.keys(t[o]).length?a+="@".concat(o,"(").concat(nd(t[o]),")"):a+="@".concat(o))}),a},{setStringify:function(r){var e=nd;return nd=r,e}});function Bg(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return Yu(t,i,a,e)}),t}return null}function Co(r){return r.alias?r.alias.value:r.name.value}function vv(r,e,t){for(var n,i=0,a=e.selections;i<a.length;i++){var s=a[i];if(So(s)){if(s.name.value==="__typename")return r[Co(s)]}else n?n.push(s):n=[s]}if(typeof r.__typename=="string")return r.__typename;if(n)for(var o=0,l=n;o<l.length;o++){var s=l[o],u=vv(r,Og(s,t).selectionSet,t);if(typeof u=="string")return u}}function So(r){return r.kind==="Field"}function XR(r){return r.kind==="InlineFragment"}function cc(r){Mr(r&&r.kind==="Document",115);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw qi(116,t.kind);return t});return Mr(e.length<=1,117,e.length),r}function dc(r){return cc(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Np(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function fc(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function JR(r){var e=dc(r);return Mr(e&&e.operation==="query",118),e}function KR(r){Mr(r.kind==="Document",119),Mr(r.definitions.length<=1,120);var e=r.definitions[0];return Mr(e.kind==="FragmentDefinition",121),e}function Mf(r){cc(r);for(var e,t=0,n=r.definitions;t<n.length;t++){var i=n[t];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw qi(122)}function $A(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&Yu(e,n.variable.name,n.defaultValue)}),e}let Ei=null;const Ew={};let ZR=1;const eO=()=>class{constructor(){this.id=["slot",ZR++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ei;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===Ew)break;return e!==Ei&&(Ei.slots[this.id]=t),!0}return Ei&&(Ei.slots[this.id]=Ew),!1}getValue(){if(this.hasValue())return Ei.slots[this.id]}withValue(e,t,n,i){const a={__proto__:null,[this.id]:e},s=Ei;Ei={parent:s,slots:a};try{return t.apply(i,n)}finally{Ei=s}}static bind(e){const t=Ei;return function(){const n=Ei;try{return Ei=t,e.apply(this,arguments)}finally{Ei=n}}}static noContext(e,t,n){if(Ei){const i=Ei;try{return Ei=null,e.apply(n,t)}finally{Ei=i}}else return e.apply(n,t)}};function kw(r){try{return r()}catch{}}const i0="@wry/context:Slot",tO=kw(()=>globalThis)||kw(()=>global)||Object.create(null),Tw=tO,hc=Tw[i0]||Array[i0]||(function(r){try{Object.defineProperty(Tw,i0,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}})(eO()),{bind:fX,noContext:hX}=hc,Mg=new hc,{hasOwnProperty:rO}=Object.prototype,zA=Array.from||function(r){const e=[];return r.forEach(t=>e.push(t)),e};function HA(r){const{unsubscribe:e}=r;typeof e=="function"&&(r.unsubscribe=void 0,e())}const hf=[],nO=100;function Xu(r,e){if(!r)throw new Error(e||"assertion failure")}function rk(r,e){const t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function nk(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function ik(r){return r.slice(0)}class _g{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++_g.count}peek(){if(this.value.length===1&&!Eo(this))return Fw(this),this.value[0]}recompute(e){return Xu(!this.recomputing,"already recomputing"),Fw(this),Eo(this)?iO(this,e):nk(this.value)}setDirty(){this.dirty||(this.dirty=!0,ak(this),HA(this))}dispose(){this.setDirty(),ck(this),GA(this,(e,t)=>{e.setDirty(),dk(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=hf.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(zA(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),hf.push(this.deps),this.deps=null)}}_g.count=0;function Fw(r){const e=Mg.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Eo(r)?ok(e,r):lk(e,r),e}function iO(r,e){return ck(r),Mg.withValue(r,aO,[r,e]),oO(r,e)&&sO(r),nk(r.value)}function aO(r,e){r.recomputing=!0;const{normalizeResult:t}=r;let n;t&&r.value.length===1&&(n=ik(r.value)),r.value.length=0;try{if(r.value[0]=r.fn.apply(null,e),t&&n&&!rk(n,r.value))try{r.value[0]=t(r.value[0],n[0])}catch{}}catch(i){r.value[1]=i}r.recomputing=!1}function Eo(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function sO(r){r.dirty=!1,!Eo(r)&&sk(r)}function ak(r){GA(r,ok)}function sk(r){GA(r,lk)}function GA(r,e){const t=r.parents.size;if(t){const n=zA(r.parents);for(let i=0;i<t;++i)e(n[i],r)}}function ok(r,e){Xu(r.childValues.has(e)),Xu(Eo(e));const t=!Eo(r);if(!r.dirtyChildren)r.dirtyChildren=hf.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&ak(r)}function lk(r,e){Xu(r.childValues.has(e)),Xu(!Eo(e));const t=r.childValues.get(e);t.length===0?r.childValues.set(e,ik(e.value)):rk(t,e.value)||r.setDirty(),uk(r,e),!Eo(r)&&sk(r)}function uk(r,e){const t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(hf.length<nO&&hf.push(t),r.dirtyChildren=null))}function ck(r){r.childValues.size>0&&r.childValues.forEach((e,t)=>{dk(r,t)}),r.forgetDeps(),Xu(r.dirtyChildren===null)}function dk(r,e){e.parents.delete(r),r.childValues.delete(e),uk(r,e)}function oO(r,e){if(typeof r.subscribe=="function")try{HA(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}const lO={setDirty:!0,dispose:!0,forget:!0};function fk(r){const e=new Map;function t(n){const i=Mg.getValue();if(i){let a=e.get(n);a||e.set(n,a=new Set),i.dependOn(a)}}return t.dirty=function(i,a){const s=e.get(i);if(s){const o=a&&rO.call(lO,a)?a:"setDirty";zA(s).forEach(l=>l[o]()),e.delete(i),HA(s)}},t}let Iw;function uO(...r){return(Iw||(Iw=new Ls(typeof WeakMap=="function"))).lookupArray(r)}const a0=new Set;function Ju(r,{max:e=Math.pow(2,16),keyArgs:t,makeCacheKey:n=uO,normalizeResult:i,subscribe:a,cache:s=mv}=Object.create(null)){const o=typeof s=="function"?new s(e,d=>d.dispose()):s,l=function(){const d=n.apply(null,t?t.apply(null,arguments):arguments);if(d===void 0)return r.apply(null,arguments);let h=o.get(d);h||(o.set(d,h=new _g(r)),h.normalizeResult=i,h.subscribe=a,h.forget=()=>o.delete(d));const g=h.recompute(Array.prototype.slice.call(arguments));return o.set(d,h),a0.add(o),Mg.hasValue()||(a0.forEach(y=>y.clean()),a0.clear()),g};Object.defineProperty(l,"size",{get:()=>o.size,configurable:!1,enumerable:!1}),Object.freeze(l.options={max:e,keyArgs:t,makeCacheKey:n,normalizeResult:i,subscribe:a,cache:o});function u(d){const h=d&&o.get(d);h&&h.setDirty()}l.dirtyKey=u,l.dirty=function(){u(n.apply(null,arguments))};function c(d){const h=d&&o.get(d);if(h)return h.peek()}l.peekKey=c,l.peek=function(){return c(n.apply(null,arguments))};function f(d){return d?o.delete(d):!1}return l.forgetKey=f,l.forget=function(){return f(n.apply(null,arguments))},l.makeCacheKey=n,l.getKey=t?function(){return n.apply(null,t.apply(null,arguments))}:n,Object.freeze(l)}function cO(r){return r}var hk=(function(){function r(e,t){t===void 0&&(t=Object.create(null)),this.resultCache=VA?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=t.cache!==!1,this.resetCache()}return r.prototype.getCacheKey=function(e){return[e]},r.identity=function(){return new r(cO,{cache:!1})},r.split=function(e,t,n){return n===void 0&&(n=r.identity()),Object.assign(new r(function(i){var a=e(i)?t:n;return a.transformDocument(i)},{cache:!1}),{left:t,right:n})},r.prototype.resetCache=function(){var e=this;if(this.cached){var t=new Ls(Dl);this.performWork=Ju(r.prototype.performWork.bind(this),{makeCacheKey:function(n){var i=e.getCacheKey(n);if(i)return Mr(Array.isArray(i),104),t.lookupArray(i)},max:Ns["documentTransform.cache"],cache:ff})}},r.prototype.performWork=function(e){return cc(e),this.transform(e)},r.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.performWork(e);return this.resultCache.add(t),t},r.prototype.concat=function(e){var t=this;return Object.assign(new r(function(n){return e.transformDocument(t.transformDocument(n))},{cache:!1}),{left:this,right:e})},r})(),s0,xl=Object.assign(function(r){var e=s0.get(r);return e||(e=X2(r),s0.set(r,e)),e},{reset:function(){s0=new ek(Ns.print||2e3)}});xl.reset();var ii=Array.isArray;function cs(r){return Array.isArray(r)&&r.length>0}var Pw={kind:et.FIELD,name:{kind:et.NAME,value:"__typename"}};function pk(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===et.FRAGMENT_SPREAD&&pk(e[t.name.value],e)})}function dO(r){return pk(dc(r)||KR(r),uc(fc(r)))?null:r}function fO(r){var e=new Map,t=new Map;return r.forEach(function(n){n&&(n.name?e.set(n.name,n):n.test&&t.set(n.test,n))}),function(n){var i=e.get(n.name.value);return!i&&t.size&&t.forEach(function(a,s){s(n)&&(i=a)}),i}}function Dw(r){var e=new Map;return function(n){n===void 0&&(n=r);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function gk(r,e){cc(e);for(var t=Dw(""),n=Dw(""),i=function(A){for(var x=0,S=void 0;x<A.length&&(S=A[x]);++x)if(!ii(S)){if(S.kind===et.OPERATION_DEFINITION)return t(S.name&&S.name.value);if(S.kind===et.FRAGMENT_DEFINITION)return n(S.name.value)}return null},a=0,s=e.definitions.length-1;s>=0;--s)e.definitions[s].kind===et.OPERATION_DEFINITION&&++a;var o=fO(r),l=function(A){return cs(A)&&A.map(o).some(function(x){return x&&x.remove})},u=new Map,c=!1,f={enter:function(A){if(l(A.directives))return c=!0,null}},d=Da(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(A,x,S,F,E){var R=i(E);R&&R.variables.add(A.name.value)}},FragmentSpread:{enter:function(A,x,S,F,E){if(l(A.directives))return c=!0,null;var R=i(E);R&&R.fragmentSpreads.add(A.name.value)}},FragmentDefinition:{enter:function(A,x,S,F){u.set(JSON.stringify(F),A)},leave:function(A,x,S,F){var E=u.get(JSON.stringify(F));if(A===E)return A;if(a>0&&A.selectionSet.selections.every(function(R){return R.kind===et.FIELD&&R.name.value==="__typename"}))return n(A.name.value).removed=!0,c=!0,null}},Directive:{leave:function(A){if(o(A))return c=!0,null}}});if(!c)return e;var h=function(A){return A.transitiveVars||(A.transitiveVars=new Set(A.variables),A.removed||A.fragmentSpreads.forEach(function(x){h(n(x)).transitiveVars.forEach(function(S){A.transitiveVars.add(S)})})),A},g=new Set;d.definitions.forEach(function(A){A.kind===et.OPERATION_DEFINITION?h(t(A.name&&A.name.value)).fragmentSpreads.forEach(function(x){g.add(x)}):A.kind===et.FRAGMENT_DEFINITION&&a===0&&!n(A.name.value).removed&&g.add(A.name.value)}),g.forEach(function(A){h(n(A)).fragmentSpreads.forEach(function(x){g.add(x)})});var y=function(A){return!!(!g.has(A)||n(A).removed)},v={enter:function(A){if(y(A.name.value))return null}};return dO(Da(d,{FragmentSpread:v,FragmentDefinition:v,OperationDefinition:{leave:function(A){if(A.variableDefinitions){var x=h(t(A.name&&A.name.value)).transitiveVars;if(x.size<A.variableDefinitions.length)return me(me({},A),{variableDefinitions:A.variableDefinitions.filter(function(S){return x.has(S.variable.name.value)})})}}}}))}var mk=Object.assign(function(r){return Da(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===et.OPERATION_DEFINITION)){var i=e.selections;if(i){var a=i.some(function(o){return So(o)&&(o.name.value==="__typename"||o.name.value.lastIndexOf("__",0)===0)});if(!a){var s=n;if(!(So(s)&&s.directives&&s.directives.some(function(o){return o.name.value==="export"})))return me(me({},e),{selections:na(na([],i,!0),[Pw],!1)})}}}}}})},{added:function(r){return r===Pw}});function hO(r){var e=Mf(r),t=e.operation;if(t==="query")return r;var n=Da(r,{OperationDefinition:{enter:function(i){return me(me({},i),{operation:"query"})}}});return n}function yk(r){cc(r);var e=gk([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}function pO(r){return cc(r),Da(r,{FragmentSpread:function(e){var t;if(!(!((t=e.directives)===null||t===void 0)&&t.some(function(n){return n.name.value==="unmask"})))return me(me({},e),{directives:na(na([],e.directives||[],!0),[{kind:et.DIRECTIVE,name:{kind:et.NAME,value:"nonreactive"}}],!1)})}})}var gO=Object.prototype.hasOwnProperty;function Rw(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Ng(r)}function Ng(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new ko,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var mO=function(r,e,t){return this.merge(r[t],e[t])},ko=(function(){function r(e){e===void 0&&(e=mO),this.reconciler=e,this.isObject=ci,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return ci(t)&&ci(e)?(Object.keys(t).forEach(function(s){if(gO.call(e,s)){var o=e[s];if(t[s]!==o){var l=n.reconciler.apply(n,na([e,t,s],i,!1));l!==o&&(e=n.shallowCopyForMerge(e),e[s]=l)}}else e=n.shallowCopyForMerge(e),e[s]=t[s]}),e):t},r.prototype.shallowCopyForMerge=function(e){return ci(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=me({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r})();function yO(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=vO(r))||e){t&&(r=t);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
55
|
+
`)))!==null&&e!==void 0?e:!1}function Cw(r){return r.kind===et.FIELD||r.kind===et.FRAGMENT_SPREAD||r.kind===et.INLINE_FRAGMENT}function Bf(r,e){var t=r.directives;return!t||!t.length?!0:bR(t).every(function(n){var i=n.directive,a=n.ifArgument,s=!1;return a.value.kind==="Variable"?(s=e&&e[a.value.name.value],Mr(s!==void 0,105,i.name.value)):s=a.value.value,i.name.value==="skip"?!s:s})}function df(r,e,t){var n=new Set(r),i=n.size;return Da(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return UA}}),t?!n.size:n.size<i}function vR(r){return r&&df(["client","export"],r,!0)}function AR(r){var e=r.name.value;return e==="skip"||e==="include"}function bR(r){var e=[];return r&&r.length&&r.forEach(function(t){if(AR(t)){var n=t.arguments,i=t.name.value;Mr(n&&n.length===1,106,i);var a=n[0];Mr(a.name&&a.name.value==="if",107,i);var s=a.value;Mr(s&&(s.kind==="Variable"||s.kind==="BooleanValue"),108,i),e.push({directive:t,ifArgument:a})}}),e}function wR(r){var e,t,n=(e=r.directives)===null||e===void 0?void 0:e.find(function(a){var s=a.name;return s.value==="unmask"});if(!n)return"mask";var i=(t=n.arguments)===null||t===void 0?void 0:t.find(function(a){var s=a.name;return s.value==="mode"});return i&&"value"in i.value&&i.value.value==="migrate"?"migrate":"unmask"}const xR=()=>Object.create(null),{forEach:CR,slice:Sw}=Array.prototype,{hasOwnProperty:SR}=Object.prototype;class Ls{constructor(e=!0,t=xR){this.weakness=e,this.makeData=t}lookup(){return this.lookupArray(arguments)}lookupArray(e){let t=this;return CR.call(e,n=>t=t.getChildTrie(n)),SR.call(t,"data")?t.data:t.data=this.makeData(Sw.call(e))}peek(){return this.peekArray(arguments)}peekArray(e){let t=this;for(let n=0,i=e.length;t&&n<i;++n){const a=t.mapFor(e[n],!1);t=a&&a.get(e[n])}return t&&t.data}remove(){return this.removeArray(arguments)}removeArray(e){let t;if(e.length){const n=e[0],i=this.mapFor(n,!1),a=i&&i.get(n);a&&(t=a.removeArray(Sw.call(e,1)),!a.data&&!a.weak&&!(a.strong&&a.strong.size)&&i.delete(n))}else t=this.data,delete this.data;return t}getChildTrie(e){const t=this.mapFor(e,!0);let n=t.get(e);return n||t.set(e,n=new Ls(this.weakness,this.makeData)),n}mapFor(e,t){return this.weakness&&ER(e)?this.weak||(t?this.weak=new WeakMap:void 0):this.strong||(t?this.strong=new Map:void 0)}}function ER(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var kR=Ia(function(){return navigator.product})=="ReactNative",Dl=typeof WeakMap=="function"&&!(kR&&!global.HermesInternal),VA=typeof WeakSet=="function",J2=typeof Symbol=="function"&&typeof Symbol.for=="function",Rg=J2&&Symbol.asyncIterator;Ia(function(){return window.document.createElement});Ia(function(){return navigator.userAgent.indexOf("jsdom")>=0});function ci(r){return r!==null&&typeof r=="object"}function K2(r){return r!==null&&typeof r=="object"&&(Object.getPrototypeOf(r)===Object.prototype||Object.getPrototypeOf(r)===null)}function TR(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw qi(112,a.operation,a.name?" named '".concat(a.name.value,"'"):"");a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(Mr(n.length===1,113,n.length),t=n[0].name.value);var i=me(me({},r),{definitions:na([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function uc(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Og(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var n=e&&e[t];return Mr(n,114,t),n||null}default:return null}}function FR(){}class mv{constructor(e=1/0,t=FR){this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}get size(){return this.map.size}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)}clean(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)}delete(e){const t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1}}function yv(){}const IR=yv,PR=typeof WeakRef<"u"?WeakRef:function(r){return{deref:()=>r}},DR=typeof WeakMap<"u"?WeakMap:Map,RR=typeof FinalizationRegistry<"u"?FinalizationRegistry:function(){return{register:yv,unregister:yv}},OR=10024;class ff{constructor(e=1/0,t=IR){this.max=e,this.dispose=t,this.map=new DR,this.newest=null,this.oldest=null,this.unfinalizedNodes=new Set,this.finalizationScheduled=!1,this.size=0,this.finalize=()=>{const n=this.unfinalizedNodes.values();for(let i=0;i<OR;i++){const a=n.next().value;if(!a)break;this.unfinalizedNodes.delete(a);const s=a.key;delete a.key,a.keyRef=new PR(s),this.registry.register(s,a,a)}this.unfinalizedNodes.size>0?queueMicrotask(this.finalize):this.finalizationScheduled=!1},this.registry=new RR(this.deleteNode.bind(this))}has(e){return this.map.has(e)}get(e){const t=this.getNode(e);return t&&t.value}getNode(e){const t=this.map.get(e);if(t&&t!==this.newest){const{older:n,newer:i}=t;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t}set(e,t){let n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.scheduleFinalization(n),this.map.set(e,n),this.size++,n.value)}clean(){for(;this.oldest&&this.size>this.max;)this.deleteNode(this.oldest)}deleteNode(e){e===this.newest&&(this.newest=e.older),e===this.oldest&&(this.oldest=e.newer),e.newer&&(e.newer.older=e.older),e.older&&(e.older.newer=e.newer),this.size--;const t=e.key||e.keyRef&&e.keyRef.deref();this.dispose(e.value,t),e.keyRef?this.registry.unregister(e):this.unfinalizedNodes.delete(e),t&&this.map.delete(t)}delete(e){const t=this.map.get(e);return t?(this.deleteNode(t),!0):!1}scheduleFinalization(e){this.unfinalizedNodes.add(e),this.finalizationScheduled||(this.finalizationScheduled=!0,queueMicrotask(this.finalize))}}var n0=new WeakSet;function Z2(r){r.size<=(r.max||-1)||n0.has(r)||(n0.add(r),setTimeout(function(){r.clean(),n0.delete(r)},100))}var ek=function(r,e){var t=new ff(r,e);return t.set=function(n,i){var a=ff.prototype.set.call(this,n,i);return Z2(this),a},t},BR=function(r,e){var t=new mv(r,e);return t.set=function(n,i){var a=mv.prototype.set.call(this,n,i);return Z2(this),a},t},MR=Symbol.for("apollo.cacheSize"),Ns=me({},sg[MR]),vo=Object.assign(function(e){return JSON.stringify(e,_R)},{reset:function(){Bd=new BR(Ns.canonicalStringify||1e3)}}),Bd;vo.reset();function _R(r,e){if(e&&typeof e=="object"){var t=Object.getPrototypeOf(e);if(t===Object.prototype||t===null){var n=Object.keys(e);if(n.every(NR))return e;var i=JSON.stringify(n),a=Bd.get(i);if(!a){n.sort();var s=JSON.stringify(n);a=Bd.get(s)||n,Bd.set(i,a),Bd.set(s,a)}var o=Object.create(t);return a.forEach(function(l){o[l]=e[l]}),o}}return e}function NR(r,e,t){return e===0||t[e-1]<=r}function zu(r){return{__ref:String(r)}}function Fn(r){return!!(r&&typeof r=="object"&&typeof r.__ref=="string")}function LR(r){return ci(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function UR(r){return r.kind==="StringValue"}function VR(r){return r.kind==="BooleanValue"}function $R(r){return r.kind==="IntValue"}function zR(r){return r.kind==="FloatValue"}function HR(r){return r.kind==="Variable"}function GR(r){return r.kind==="ObjectValue"}function jR(r){return r.kind==="ListValue"}function qR(r){return r.kind==="EnumValue"}function WR(r){return r.kind==="NullValue"}function Yu(r,e,t,n){if($R(t)||zR(t))r[e.value]=Number(t.value);else if(VR(t)||UR(t))r[e.value]=t.value;else if(GR(t)){var i={};t.fields.map(function(s){return Yu(i,s.name,s.value,n)}),r[e.value]=i}else if(HR(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(jR(t))r[e.value]=t.values.map(function(s){var o={};return Yu(o,e,s,n),o[e.value]});else if(qR(t))r[e.value]=t.value;else if(WR(t))r[e.value]=null;else throw qi(123,e.value,t.kind)}function QR(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(i){t[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var s=a.name,o=a.value;return Yu(t[i.name.value],s,o,e)})}));var n=null;return r.arguments&&r.arguments.length&&(n={},r.arguments.forEach(function(i){var a=i.name,s=i.value;return Yu(n,a,s,e)})),tk(r.name.value,n,t)}var YR=["connection","include","skip","client","rest","export","nonreactive"],nd=vo,tk=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var n=t.connection.filter?t.connection.filter:[];n.sort();var i={};return n.forEach(function(o){i[o]=e[o]}),"".concat(t.connection.key,"(").concat(nd(i),")")}else return t.connection.key;var a=r;if(e){var s=nd(e);a+="(".concat(s,")")}return t&&Object.keys(t).forEach(function(o){YR.indexOf(o)===-1&&(t[o]&&Object.keys(t[o]).length?a+="@".concat(o,"(").concat(nd(t[o]),")"):a+="@".concat(o))}),a},{setStringify:function(r){var e=nd;return nd=r,e}});function Bg(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return Yu(t,i,a,e)}),t}return null}function Co(r){return r.alias?r.alias.value:r.name.value}function vv(r,e,t){for(var n,i=0,a=e.selections;i<a.length;i++){var s=a[i];if(So(s)){if(s.name.value==="__typename")return r[Co(s)]}else n?n.push(s):n=[s]}if(typeof r.__typename=="string")return r.__typename;if(n)for(var o=0,l=n;o<l.length;o++){var s=l[o],u=vv(r,Og(s,t).selectionSet,t);if(typeof u=="string")return u}}function So(r){return r.kind==="Field"}function XR(r){return r.kind==="InlineFragment"}function cc(r){Mr(r&&r.kind==="Document",115);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw qi(116,t.kind);return t});return Mr(e.length<=1,117,e.length),r}function dc(r){return cc(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Np(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function fc(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function JR(r){var e=dc(r);return Mr(e&&e.operation==="query",118),e}function KR(r){Mr(r.kind==="Document",119),Mr(r.definitions.length<=1,120);var e=r.definitions[0];return Mr(e.kind==="FragmentDefinition",121),e}function Mf(r){cc(r);for(var e,t=0,n=r.definitions;t<n.length;t++){var i=n[t];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw qi(122)}function $A(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&Yu(e,n.variable.name,n.defaultValue)}),e}let Ei=null;const Ew={};let ZR=1;const eO=()=>class{constructor(){this.id=["slot",ZR++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ei;e;e=e.parent)if(this.id in e.slots){const t=e.slots[this.id];if(t===Ew)break;return e!==Ei&&(Ei.slots[this.id]=t),!0}return Ei&&(Ei.slots[this.id]=Ew),!1}getValue(){if(this.hasValue())return Ei.slots[this.id]}withValue(e,t,n,i){const a={__proto__:null,[this.id]:e},s=Ei;Ei={parent:s,slots:a};try{return t.apply(i,n)}finally{Ei=s}}static bind(e){const t=Ei;return function(){const n=Ei;try{return Ei=t,e.apply(this,arguments)}finally{Ei=n}}}static noContext(e,t,n){if(Ei){const i=Ei;try{return Ei=null,e.apply(n,t)}finally{Ei=i}}else return e.apply(n,t)}};function kw(r){try{return r()}catch{}}const i0="@wry/context:Slot",tO=kw(()=>globalThis)||kw(()=>global)||Object.create(null),Tw=tO,hc=Tw[i0]||Array[i0]||(function(r){try{Object.defineProperty(Tw,i0,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}})(eO()),{bind:hX,noContext:pX}=hc,Mg=new hc,{hasOwnProperty:rO}=Object.prototype,zA=Array.from||function(r){const e=[];return r.forEach(t=>e.push(t)),e};function HA(r){const{unsubscribe:e}=r;typeof e=="function"&&(r.unsubscribe=void 0,e())}const hf=[],nO=100;function Xu(r,e){if(!r)throw new Error(e||"assertion failure")}function rk(r,e){const t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function nk(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function ik(r){return r.slice(0)}class _g{constructor(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++_g.count}peek(){if(this.value.length===1&&!Eo(this))return Fw(this),this.value[0]}recompute(e){return Xu(!this.recomputing,"already recomputing"),Fw(this),Eo(this)?iO(this,e):nk(this.value)}setDirty(){this.dirty||(this.dirty=!0,ak(this),HA(this))}dispose(){this.setDirty(),ck(this),GA(this,(e,t)=>{e.setDirty(),dk(e,this)})}forget(){this.dispose()}dependOn(e){e.add(this),this.deps||(this.deps=hf.pop()||new Set),this.deps.add(e)}forgetDeps(){this.deps&&(zA(this.deps).forEach(e=>e.delete(this)),this.deps.clear(),hf.push(this.deps),this.deps=null)}}_g.count=0;function Fw(r){const e=Mg.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Eo(r)?ok(e,r):lk(e,r),e}function iO(r,e){return ck(r),Mg.withValue(r,aO,[r,e]),oO(r,e)&&sO(r),nk(r.value)}function aO(r,e){r.recomputing=!0;const{normalizeResult:t}=r;let n;t&&r.value.length===1&&(n=ik(r.value)),r.value.length=0;try{if(r.value[0]=r.fn.apply(null,e),t&&n&&!rk(n,r.value))try{r.value[0]=t(r.value[0],n[0])}catch{}}catch(i){r.value[1]=i}r.recomputing=!1}function Eo(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function sO(r){r.dirty=!1,!Eo(r)&&sk(r)}function ak(r){GA(r,ok)}function sk(r){GA(r,lk)}function GA(r,e){const t=r.parents.size;if(t){const n=zA(r.parents);for(let i=0;i<t;++i)e(n[i],r)}}function ok(r,e){Xu(r.childValues.has(e)),Xu(Eo(e));const t=!Eo(r);if(!r.dirtyChildren)r.dirtyChildren=hf.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&ak(r)}function lk(r,e){Xu(r.childValues.has(e)),Xu(!Eo(e));const t=r.childValues.get(e);t.length===0?r.childValues.set(e,ik(e.value)):rk(t,e.value)||r.setDirty(),uk(r,e),!Eo(r)&&sk(r)}function uk(r,e){const t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(hf.length<nO&&hf.push(t),r.dirtyChildren=null))}function ck(r){r.childValues.size>0&&r.childValues.forEach((e,t)=>{dk(r,t)}),r.forgetDeps(),Xu(r.dirtyChildren===null)}function dk(r,e){e.parents.delete(r),r.childValues.delete(e),uk(r,e)}function oO(r,e){if(typeof r.subscribe=="function")try{HA(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}const lO={setDirty:!0,dispose:!0,forget:!0};function fk(r){const e=new Map;function t(n){const i=Mg.getValue();if(i){let a=e.get(n);a||e.set(n,a=new Set),i.dependOn(a)}}return t.dirty=function(i,a){const s=e.get(i);if(s){const o=a&&rO.call(lO,a)?a:"setDirty";zA(s).forEach(l=>l[o]()),e.delete(i),HA(s)}},t}let Iw;function uO(...r){return(Iw||(Iw=new Ls(typeof WeakMap=="function"))).lookupArray(r)}const a0=new Set;function Ju(r,{max:e=Math.pow(2,16),keyArgs:t,makeCacheKey:n=uO,normalizeResult:i,subscribe:a,cache:s=mv}=Object.create(null)){const o=typeof s=="function"?new s(e,d=>d.dispose()):s,l=function(){const d=n.apply(null,t?t.apply(null,arguments):arguments);if(d===void 0)return r.apply(null,arguments);let h=o.get(d);h||(o.set(d,h=new _g(r)),h.normalizeResult=i,h.subscribe=a,h.forget=()=>o.delete(d));const g=h.recompute(Array.prototype.slice.call(arguments));return o.set(d,h),a0.add(o),Mg.hasValue()||(a0.forEach(y=>y.clean()),a0.clear()),g};Object.defineProperty(l,"size",{get:()=>o.size,configurable:!1,enumerable:!1}),Object.freeze(l.options={max:e,keyArgs:t,makeCacheKey:n,normalizeResult:i,subscribe:a,cache:o});function u(d){const h=d&&o.get(d);h&&h.setDirty()}l.dirtyKey=u,l.dirty=function(){u(n.apply(null,arguments))};function c(d){const h=d&&o.get(d);if(h)return h.peek()}l.peekKey=c,l.peek=function(){return c(n.apply(null,arguments))};function f(d){return d?o.delete(d):!1}return l.forgetKey=f,l.forget=function(){return f(n.apply(null,arguments))},l.makeCacheKey=n,l.getKey=t?function(){return n.apply(null,t.apply(null,arguments))}:n,Object.freeze(l)}function cO(r){return r}var hk=(function(){function r(e,t){t===void 0&&(t=Object.create(null)),this.resultCache=VA?new WeakSet:new Set,this.transform=e,t.getCacheKey&&(this.getCacheKey=t.getCacheKey),this.cached=t.cache!==!1,this.resetCache()}return r.prototype.getCacheKey=function(e){return[e]},r.identity=function(){return new r(cO,{cache:!1})},r.split=function(e,t,n){return n===void 0&&(n=r.identity()),Object.assign(new r(function(i){var a=e(i)?t:n;return a.transformDocument(i)},{cache:!1}),{left:t,right:n})},r.prototype.resetCache=function(){var e=this;if(this.cached){var t=new Ls(Dl);this.performWork=Ju(r.prototype.performWork.bind(this),{makeCacheKey:function(n){var i=e.getCacheKey(n);if(i)return Mr(Array.isArray(i),104),t.lookupArray(i)},max:Ns["documentTransform.cache"],cache:ff})}},r.prototype.performWork=function(e){return cc(e),this.transform(e)},r.prototype.transformDocument=function(e){if(this.resultCache.has(e))return e;var t=this.performWork(e);return this.resultCache.add(t),t},r.prototype.concat=function(e){var t=this;return Object.assign(new r(function(n){return e.transformDocument(t.transformDocument(n))},{cache:!1}),{left:this,right:e})},r})(),s0,xl=Object.assign(function(r){var e=s0.get(r);return e||(e=X2(r),s0.set(r,e)),e},{reset:function(){s0=new ek(Ns.print||2e3)}});xl.reset();var ii=Array.isArray;function cs(r){return Array.isArray(r)&&r.length>0}var Pw={kind:et.FIELD,name:{kind:et.NAME,value:"__typename"}};function pk(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===et.FRAGMENT_SPREAD&&pk(e[t.name.value],e)})}function dO(r){return pk(dc(r)||KR(r),uc(fc(r)))?null:r}function fO(r){var e=new Map,t=new Map;return r.forEach(function(n){n&&(n.name?e.set(n.name,n):n.test&&t.set(n.test,n))}),function(n){var i=e.get(n.name.value);return!i&&t.size&&t.forEach(function(a,s){s(n)&&(i=a)}),i}}function Dw(r){var e=new Map;return function(n){n===void 0&&(n=r);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function gk(r,e){cc(e);for(var t=Dw(""),n=Dw(""),i=function(A){for(var x=0,S=void 0;x<A.length&&(S=A[x]);++x)if(!ii(S)){if(S.kind===et.OPERATION_DEFINITION)return t(S.name&&S.name.value);if(S.kind===et.FRAGMENT_DEFINITION)return n(S.name.value)}return null},a=0,s=e.definitions.length-1;s>=0;--s)e.definitions[s].kind===et.OPERATION_DEFINITION&&++a;var o=fO(r),l=function(A){return cs(A)&&A.map(o).some(function(x){return x&&x.remove})},u=new Map,c=!1,f={enter:function(A){if(l(A.directives))return c=!0,null}},d=Da(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(A,x,S,F,E){var R=i(E);R&&R.variables.add(A.name.value)}},FragmentSpread:{enter:function(A,x,S,F,E){if(l(A.directives))return c=!0,null;var R=i(E);R&&R.fragmentSpreads.add(A.name.value)}},FragmentDefinition:{enter:function(A,x,S,F){u.set(JSON.stringify(F),A)},leave:function(A,x,S,F){var E=u.get(JSON.stringify(F));if(A===E)return A;if(a>0&&A.selectionSet.selections.every(function(R){return R.kind===et.FIELD&&R.name.value==="__typename"}))return n(A.name.value).removed=!0,c=!0,null}},Directive:{leave:function(A){if(o(A))return c=!0,null}}});if(!c)return e;var h=function(A){return A.transitiveVars||(A.transitiveVars=new Set(A.variables),A.removed||A.fragmentSpreads.forEach(function(x){h(n(x)).transitiveVars.forEach(function(S){A.transitiveVars.add(S)})})),A},g=new Set;d.definitions.forEach(function(A){A.kind===et.OPERATION_DEFINITION?h(t(A.name&&A.name.value)).fragmentSpreads.forEach(function(x){g.add(x)}):A.kind===et.FRAGMENT_DEFINITION&&a===0&&!n(A.name.value).removed&&g.add(A.name.value)}),g.forEach(function(A){h(n(A)).fragmentSpreads.forEach(function(x){g.add(x)})});var y=function(A){return!!(!g.has(A)||n(A).removed)},v={enter:function(A){if(y(A.name.value))return null}};return dO(Da(d,{FragmentSpread:v,FragmentDefinition:v,OperationDefinition:{leave:function(A){if(A.variableDefinitions){var x=h(t(A.name&&A.name.value)).transitiveVars;if(x.size<A.variableDefinitions.length)return me(me({},A),{variableDefinitions:A.variableDefinitions.filter(function(S){return x.has(S.variable.name.value)})})}}}}))}var mk=Object.assign(function(r){return Da(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===et.OPERATION_DEFINITION)){var i=e.selections;if(i){var a=i.some(function(o){return So(o)&&(o.name.value==="__typename"||o.name.value.lastIndexOf("__",0)===0)});if(!a){var s=n;if(!(So(s)&&s.directives&&s.directives.some(function(o){return o.name.value==="export"})))return me(me({},e),{selections:na(na([],i,!0),[Pw],!1)})}}}}}})},{added:function(r){return r===Pw}});function hO(r){var e=Mf(r),t=e.operation;if(t==="query")return r;var n=Da(r,{OperationDefinition:{enter:function(i){return me(me({},i),{operation:"query"})}}});return n}function yk(r){cc(r);var e=gk([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}function pO(r){return cc(r),Da(r,{FragmentSpread:function(e){var t;if(!(!((t=e.directives)===null||t===void 0)&&t.some(function(n){return n.name.value==="unmask"})))return me(me({},e),{directives:na(na([],e.directives||[],!0),[{kind:et.DIRECTIVE,name:{kind:et.NAME,value:"nonreactive"}}],!1)})}})}var gO=Object.prototype.hasOwnProperty;function Rw(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Ng(r)}function Ng(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new ko,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var mO=function(r,e,t){return this.merge(r[t],e[t])},ko=(function(){function r(e){e===void 0&&(e=mO),this.reconciler=e,this.isObject=ci,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return ci(t)&&ci(e)?(Object.keys(t).forEach(function(s){if(gO.call(e,s)){var o=e[s];if(t[s]!==o){var l=n.reconciler.apply(n,na([e,t,s],i,!1));l!==o&&(e=n.shallowCopyForMerge(e),e[s]=l)}}else e=n.shallowCopyForMerge(e),e[s]=t[s]}),e):t},r.prototype.shallowCopyForMerge=function(e){return ci(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=me({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r})();function yO(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=vO(r))||e){t&&(r=t);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
56
56
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function vO(r,e){if(r){if(typeof r=="string")return Ow(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ow(r,e)}}function Ow(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Bw(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function jA(r,e,t){return e&&Bw(r.prototype,e),t&&Bw(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var qA=function(){return typeof Symbol=="function"},WA=function(r){return qA()&&!!Symbol[r]},QA=function(r){return WA(r)?Symbol[r]:"@@"+r};qA()&&!WA("observable")&&(Symbol.observable=Symbol("observable"));var AO=QA("iterator"),Av=QA("observable"),vk=QA("species");function og(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function id(r){var e=r.constructor;return e!==void 0&&(e=e[vk],e===null&&(e=void 0)),e!==void 0?e:sn}function bO(r){return r instanceof sn}function Ku(r){Ku.log?Ku.log(r):setTimeout(function(){throw r})}function Lp(r){Promise.resolve().then(function(){try{r()}catch(e){Ku(e)}})}function Ak(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=og(e,"unsubscribe");t&&t.call(e)}}catch(n){Ku(n)}}function bv(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function wO(r){var e=r._queue;if(e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(bk(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function bk(r,e,t){r._state="running";var n=r._observer;try{var i=og(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(bv(r),i)i.call(n,t);else throw t;break;case"complete":bv(r),i&&i.call(n);break}}catch(a){Ku(a)}r._state==="closed"?Ak(r):r._state==="running"&&(r._state="ready")}function o0(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],Lp(function(){return wO(r)});return}bk(r,e,t)}}var xO=(function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new CO(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(bv(this),Ak(this))},jA(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r})(),CO=(function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){o0(this._subscription,"next",n)},e.error=function(n){o0(this._subscription,"error",n)},e.complete=function(){o0(this._subscription,"complete")},jA(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r})(),sn=(function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new xO(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,s){if(typeof n!="function"){s(new TypeError(n+" is not a function"));return}function o(){l.unsubscribe(),a()}var l=i.subscribe({next:function(u){try{n(u,o)}catch(c){s(c),l.unsubscribe()}},error:s,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=id(this);return new a(function(s){return i.subscribe({next:function(o){try{o=n(o)}catch(l){return s.error(l)}s.next(o)},error:function(o){s.error(o)},complete:function(){s.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=id(this);return new a(function(s){return i.subscribe({next:function(o){try{if(!n(o))return}catch(l){return s.error(l)}s.next(o)},error:function(o){s.error(o)},complete:function(){s.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=id(this),s=arguments.length>1,o=!1,l=arguments[1],u=l;return new a(function(c){return i.subscribe({next:function(f){var d=!o;if(o=!0,!d||s)try{u=n(u,f)}catch(h){return c.error(h)}else u=f},error:function(f){c.error(f)},complete:function(){if(!o&&!s)return c.error(new TypeError("Cannot reduce an empty sequence"));c.next(u),c.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s<i;s++)a[s]=arguments[s];var o=id(this);return new o(function(l){var u,c=0;function f(d){u=d.subscribe({next:function(h){l.next(h)},error:function(h){l.error(h)},complete:function(){c===a.length?(u=void 0,l.complete()):f(o.from(a[c++]))}})}return f(n),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=id(this);return new a(function(s){var o=[],l=i.subscribe({next:function(c){if(n)try{c=n(c)}catch(d){return s.error(d)}var f=a.from(c).subscribe({next:function(d){s.next(d)},error:function(d){s.error(d)},complete:function(){var d=o.indexOf(f);d>=0&&o.splice(d,1),u()}});o.push(f)},error:function(c){s.error(c)},complete:function(){u()}});function u(){l.closed&&o.length===0&&s.complete()}return function(){o.forEach(function(c){return c.unsubscribe()}),l.unsubscribe()}})},e[Av]=function(){return this},r.from=function(n){var i=typeof this=="function"?this:r;if(n==null)throw new TypeError(n+" is not an object");var a=og(n,Av);if(a){var s=a.call(n);if(Object(s)!==s)throw new TypeError(s+" is not an object");return bO(s)&&s.constructor===i?s:new i(function(o){return s.subscribe(o)})}if(WA("iterator")&&(a=og(n,AO),a))return new i(function(o){Lp(function(){if(!o.closed){for(var l=yO(a.call(n)),u;!(u=l()).done;){var c=u.value;if(o.next(c),o.closed)return}o.complete()}})});if(Array.isArray(n))return new i(function(o){Lp(function(){if(!o.closed){for(var l=0;l<n.length;++l)if(o.next(n[l]),o.closed)return;o.complete()}})});throw new TypeError(n+" is not observable")},r.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var s=typeof this=="function"?this:r;return new s(function(o){Lp(function(){if(!o.closed){for(var l=0;l<i.length;++l)if(o.next(i[l]),o.closed)return;o.complete()}})})},jA(r,null,[{key:vk,get:function(){return this}}]),r})();qA()&&Object.defineProperty(sn,Symbol("extensions"),{value:{symbol:Av,hostReportError:Ku},configurable:!0});function SO(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var Pu;typeof self<"u"?Pu=self:typeof window<"u"?Pu=window:typeof global<"u"?Pu=global:typeof module<"u"?Pu=module:Pu=Function("return this")();SO(Pu);var Mw=sn.prototype,_w="@@observable";Mw[_w]||(Mw[_w]=function(){return this});function EO(r){return r.catch(function(){}),r}var kO=Object.prototype.toString;function TO(r){return wv(r)}function wv(r,e){switch(kO.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(i,a){t[a]=wv(i,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var n=Object.create(Object.getPrototypeOf(r));return e.set(r,n),Object.keys(r).forEach(function(i){n[i]=wv(r[i],e)}),n}default:return r}}function Qd(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function l0(r,e,t){return new sn(function(n){var i={then:function(l){return new Promise(function(u){return u(l())})}};function a(l,u){return function(c){if(l){var f=function(){return n.closed?0:l(c)};i=i.then(f,f).then(function(d){return n.next(d)},function(d){return n.error(d)})}else n[u](c)}}var s={next:a(e,"next"),error:a(t,"error"),complete:function(){i.then(function(){return n.complete()})}},o=r.subscribe(s);return function(){return o.unsubscribe()}})}function wk(r){function e(t){Object.defineProperty(r,t,{value:sn})}return J2&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Nw(r){return r&&typeof r.then=="function"}var Du=(function(r){ma(e,r);function e(t){var n=r.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),Qd(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),Qd(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,s=i.sources,o=s===void 0?[]:s;if(a!==null){var l=o.shift();l?Nw(l)?l.then(function(u){return n.sub=u.subscribe(n.handlers)},n.handlers.error):n.sub=l.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),Qd(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.error(i)},n.promise.catch(function(i){}),typeof t=="function"&&(t=[new sn(t)]),Nw(t)?t.then(function(i){return n.start(i)},n.handlers.error):n.start(t),n}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var n=this.latest[0],i=t[n];i&&i.call(t,this.latest[1]),this.sub===null&&n==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(t,n)}))},e.prototype.beforeNext=function(t){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,t(i,a))})},e})(sn);wk(Du);function Hu(r){return"incremental"in r}function FO(r){return"hasNext"in r&&"data"in r}function IO(r){return Hu(r)||FO(r)}function PO(r){return ci(r)&&"payload"in r}function xk(r,e){var t=r,n=new ko;return Hu(e)&&cs(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,s=i.path,o=s.length-1;o>=0;--o){var l=s[o],u=!isNaN(+l),c=u?[]:{};c[l]=a,a=c}t=n.merge(t,a)}),t}function Up(r){var e=xv(r);return cs(e)}function xv(r){var e=cs(r.errors)?r.errors.slice(0):[];return Hu(r)&&cs(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Zu(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(n){n&&Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(t[i]=a)})}),t}function u0(r,e){return Zu(r,e,e.variables&&{variables:Zu(me(me({},r&&r.variables),e.variables))})}function DO(r,e){return Cv(r,e)}function Cv(r,e,t){if(t===void 0&&(t=new Map),t.has(r))return t.get(r);var n=!1;if(Array.isArray(r)){var i=[];if(t.set(r,i),r.forEach(function(s,o){var l=Cv(s,e,t);n||(n=l!==s),i[o]=l}),n)return i}else if(K2(r)){var a=Object.create(Object.getPrototypeOf(r));if(t.set(r,a),Object.keys(r).forEach(function(s){if(s===e){n=!0;return}var o=Cv(r[s],e,t);n||(n=o!==r[s]),a[s]=o}),n)return a}return r}function YA(r){return DO(r,"__typename")}var c0,Lw=Symbol.for("apollo.deprecations.slot"),Uw=sg,Vw=(c0=Uw[Lw])!==null&&c0!==void 0?c0:Uw[Lw]=new hc;function Di(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];return Vw.withValue.apply(Vw,na([Array.isArray(r)?r:[r]],e,!1))}function d0(r){return new sn(function(e){e.error(r)})}var Ck=function(r,e,t){var n=new Error(t);throw n.name="ServerError",n.response=r,n.statusCode=r.status,n.result=e,n};function RO(r){for(var e=["query","operationName","variables","extensions","context"],t=0,n=Object.keys(r);t<n.length;t++){var i=n[t];if(e.indexOf(i)<0)throw qi(58,i)}return r}function OO(r,e){var t=me({},r),n=function(a){typeof a=="function"?t=me(me({},t),a(t)):t=me(me({},t),a)},i=function(){return me({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function BO(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Np(e.query)||void 0:""),e}function MO(r,e){var t=me({},r),n=new Set(Object.keys(r));return Da(e,{Variable:function(i,a,s){s&&s.kind!=="VariableDefinition"&&n.delete(i.name.value)}}),n.forEach(function(i){delete t[i]}),t}function $w(r,e){return e?e(r):sn.of()}function ad(r){return typeof r=="function"?new Na(r):r}function zh(r){return r.request.length<=1}var Na=(function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return sn.of()})},r.from=function(e){return e.length===0?r.empty():e.map(ad).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=ad(t),a=ad(n||new r($w)),s;return zh(i)&&zh(a)?s=new r(function(o){return e(o)?i.request(o)||sn.of():a.request(o)||sn.of()}):s=new r(function(o,l){return e(o)?i.request(o,l)||sn.of():a.request(o,l)||sn.of()}),Object.assign(s,{left:i,right:a})},r.execute=function(e,t){return e.request(OO(t.context,BO(RO(t))))||sn.of()},r.concat=function(e,t){var n=ad(e);if(zh(n))return n;var i=ad(t),a;return zh(i)?a=new r(function(s){return n.request(s,function(o){return i.request(o)||sn.of()})||sn.of()}):a=new r(function(s,o){return n.request(s,function(l){return i.request(l,o)||sn.of()})||sn.of()}),Object.assign(a,{left:n,right:i})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r($w)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw qi(48)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r})(),_O=Na.from,Sv=Na.execute;function NO(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function LO(r){var e=null,t=null,n=!1,i=[],a=[];function s(f){if(!t){if(a.length){var d=a.shift();if(Array.isArray(d)&&d[0])return d[0]({value:f,done:!1})}i.push(f)}}function o(f){t=f;var d=a.slice();d.forEach(function(h){h[1](f)}),!e||e()}function l(){n=!0;var f=a.slice();f.forEach(function(d){d[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",s),r.removeListener("error",o),r.removeListener("end",l),r.removeListener("finish",l),r.removeListener("close",l)},r.on("data",s),r.on("error",o),r.on("end",l),r.on("finish",l),r.on("close",l);function u(){return new Promise(function(f,d){if(t)return d(t);if(i.length)return f({value:i.shift(),done:!1});if(n)return f({value:void 0,done:!0});a.push([f,d])})}var c={next:function(){return u()}};return Rg&&(c[Symbol.asyncIterator]=function(){return this}),c}function UO(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){r.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return Rg&&(t[Symbol.asyncIterator]=function(){return this}),t}function zw(r){var e={next:function(){return r.read()}};return Rg&&(e[Symbol.asyncIterator]=function(){return this}),e}function VO(r){return!!r.body}function $O(r){return!!r.getReader}function zO(r){return!!(Rg&&r[Symbol.asyncIterator])}function HO(r){return!!r.stream}function GO(r){return!!r.arrayBuffer}function jO(r){return!!r.pipe}function qO(r){var e=r;if(VO(r)&&(e=r.body),zO(e))return NO(e);if($O(e))return zw(e.getReader());if(HO(e))return zw(e.stream().getReader());if(GO(e))return UO(e.arrayBuffer());if(jO(e))return LO(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var _f=Symbol();function XA(r){return r.extensions?Array.isArray(r.extensions[_f]):!1}function Sk(r){return r.hasOwnProperty("graphQLErrors")}var WO=function(r){var e=na(na(na([],r.graphQLErrors,!0),r.clientErrors,!0),r.protocolErrors,!0);return r.networkError&&e.push(r.networkError),e.map(function(t){return ci(t)&&t.message||"Error message not found."}).join(`
|
|
57
57
|
`)},oo=(function(r){ma(e,r);function e(t){var n=t.graphQLErrors,i=t.protocolErrors,a=t.clientErrors,s=t.networkError,o=t.errorMessage,l=t.extraInfo,u=r.call(this,o)||this;return u.name="ApolloError",u.graphQLErrors=n||[],u.protocolErrors=i||[],u.clientErrors=a||[],u.networkError=s||null,u.message=o||WO(u),u.extraInfo=l,u.cause=na(na(na([s],n||[],!0),i||[],!0),a||[],!0).find(function(c){return!!c})||null,u.__proto__=e.prototype,u}return e})(Error),Hw=Object.prototype.hasOwnProperty;function QO(r,e){return rs(this,void 0,void 0,function(){var t,n,i,a,s,o,l,u,c,f,d,h,g,y,v,A,x,S,F,E,R,O,W,Y;return ns(this,function(ae){switch(ae.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");t=new TextDecoder("utf-8"),n=(Y=r.headers)===null||Y===void 0?void 0:Y.get("content-type"),i="boundary=",a=n?.includes(i)?n?.substring(n?.indexOf(i)+i.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",s=`\r
|
|
58
58
|
--`.concat(a),o="",l=qO(r),u=!0,ae.label=1;case 1:return u?[4,l.next()]:[3,3];case 2:for(c=ae.sent(),f=c.value,d=c.done,h=typeof f=="string"?f:t.decode(f),g=o.length-s.length+1,u=!d,o+=h,y=o.indexOf(s,g);y>-1;){if(v=void 0,O=[o.slice(0,y),o.slice(y+s.length)],v=O[0],o=O[1],A=v.indexOf(`\r
|
|
@@ -1896,7 +1896,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
1896
1896
|
/>
|
|
1897
1897
|
</svg>
|
|
1898
1898
|
`,d={browserValue:s.color||"#000000"},h={"spiff-fill-shape":d},g=Ar();return console.log(`[handleShapeStep] Creating shape element ${g}.`,{panelId:u.panelId,fill:d.browserValue}),new ai({colors:h,id:g,svg:f,type:er.Illustration,y:u.top,x:u.left,rotation:u.rotation,width:u.width,height:u.height,layer:u.layer,layerIndex:u.layerIndex,immutable:u.immutable},c)},l=n.data.regions;try{const u=l.map(o);return console.log(`[handleShapeStep] Done with ${u.length} command(s).`),u}catch(u){return console.error(`[handleShapeStep] Failed for step "${t.name}".`,u),[]}},d9=async(r,e,t)=>{console.log(`[handleSilentStep] Start for step "${e.stepName}".`,{stepType:e.type,layoutCount:r.length,regionCount:e.data.regions.length,productOverlayImageUrl:t});const n=[],a=e.type===Ye.ProductOverlay?t||e.data.asset?.fileLink||"":e.data.asset?.fileLink||"",o=(()=>{const u=bf(a);return u==="jpeg"||u==="jpg"||u==="png"?er.Image:er.Illustration})(),l=e.data.regions;if(console.log("[handleSilentStep] Resolved asset.",{assetSource:a,assetType:o}),o==="image")try{l.forEach(u=>{const c=r.find(h=>h.panelId===u.panelId);if(!c)throw console.error(`[handleSilentStep] No layout for panel ${u.panelId}.`),new Ai(u);const f=Ar();console.log(`[handleSilentStep] Creating image element ${f}.`,{panelId:u.panelId,excludeFromExport:e.data.excludeFromPrint});const d={id:f,src:a,type:o,y:u.top,x:u.left,width:u.width,height:u.height,layer:u.layer,layerIndex:u.layerIndex,productOverlay:e.type===Ye.ProductOverlay?!0:void 0,scaleX:1,scaleY:1,rotation:u.rotation,excludeFromExport:e.data.excludeFromPrint,preserveAspectRatio:"none"};n.push(new ai(d,c))})}catch(u){console.error(`[handleSilentStep] Failed for step "${e.stepName}".`,u)}else{console.log("[handleSilentStep] Fetching SVG asset.",{assetSource:a});const u=await ia(a,!0),c=f=>{const d=/<svg.*?<\/svg>/s,h=f.match(d)||[],g=h?.length>0?h[0]:"",A=ds().parseFromString(g,"image/svg+xml").firstElementChild;if(!A)throw console.error("[handleSilentStep] Failed to read SVG.",{assetSource:a,bodyLength:f.length}),new Cl("Failed to read SVG.");return jg(A),Mo().serializeToString(A)};l.forEach(f=>{const d=r.find(y=>y.panelId===f.panelId);if(!d)throw console.error(`[handleSilentStep] No layout for panel ${f.panelId}.`),new Ai(f);const h=Ar();console.log(`[handleSilentStep] Creating illustration element ${h}.`,{panelId:f.panelId,excludeFromExport:e.data.excludeFromPrint});const g={id:h,src:a,asset_key:a,svg:c(u),colors:{},type:o,y:f.top,x:f.left,width:f.width,height:f.height,layer:f.layer,layerIndex:f.layerIndex,scaleX:1,scaleY:1,rotation:f.rotation,productOverlay:e.type===Ye.ProductOverlay?!0:void 0,excludeFromExport:e.data.excludeFromPrint};n.push(new ai(g,d))})}return console.log(`[handleSilentStep] Done with ${n.length} command(s).`),n},f9=async(r,e,t,n)=>{console.log(`[handleTextStep] Start for step "${t.name}".`,{stepName:n.stepName,layoutCount:r.length,regionCount:n.data.regions.length});const i=[],a=t.data,s=30,o=S=>S.vertical?"center":S.textAlign||"center",l=async()=>{const S=await ct.getOptionForStep(n);if(!S){console.warn(`[handleTextStep] No font option for step ${n.stepName}.`);return}const F=S.variants?.find(R=>R.id===a.fontVariantId)||await ct.getDefaultVariant(S,n.overrideDefaultVariantId);if(!F){console.warn(`[handleTextStep] No font variant with ID: ${a.fontVariantId}`);return}if(!F.asset){console.warn(`[handleTextStep] No asset for font variant with ID: ${F.id}`);return}console.log("[handleTextStep] Resolved font variant.",{optionId:S.id,variantId:F.id}),e[n.stepName]={...e[n.stepName]??{},selectedVariants:[F]};const E=F.asset.fileLink;if(!E){console.warn(`[handleTextStep] No asset link for font variant with ID: ${F.id}`);return}return E},c=await(async()=>{const S=await l();if(!S){console.warn("[handleTextStep] No font URL; falling back to default sizing.");return}console.log("[handleTextStep] Loading font.",{fontUrl:S});const F=await _l(S),E={assetUrl:S,name:F.names.fullName.en};return console.log("[handleTextStep] Font loaded.",{name:E.name}),E})(),f=(n.data.replaceableText?n.data.replaceableText.replace("{{}}",a.text):a.text)||"",d=Ag(f,{vertical:n.data.vertical,uppercase:n.data.uppercase});console.log("[handleTextStep] Text resolved.",{replaceableText:n.data.replaceableText,inputText:a.text,text:d,vertical:n.data.vertical,uppercase:n.data.uppercase});const h=async S=>{const F=S.colorOption;return F?(await ct.getDefaultVariant(F))?.color:void 0},g=a.color||await h(n.data);console.log("[handleTextStep] Colour resolved.",{inputColor:a.color,defaultColor:g});const v=await(async S=>{const F=S.strokeOption;if(!S.strokeEnabled||!F)return;const E=await ct.getDefaultVariant(F,n.overrideDefaultVariantId);if(!E?.color){console.warn(`[handleTextStep] No default stroke variant colour for step ${n.stepName}.`);return}return{browserValue:E.color,pmsValue:E.name}})(n.data);console.log("[handleTextStep] Stroke resolved.",{strokeEnabled:n.data.strokeEnabled,strokeColor:v,strokeThickness:n.data.strokeThickness});const A=a.color||g||"#000000";e[n.stepName]={...e[n.stepName]??{},inputText:a.text,text:d,color:A,strokeColor:v};const x=n.data.regions;for(const S of x){const F=r.find(R=>R.panelId===S.panelId);if(!F){console.warn(`[handleTextStep] No layout for panel ${S.panelId}; skipping region.`);continue}const E={stepName:t.name,id:Ar(),align:o(n.data),curved:n.data.curved,fill:A,fontData:c,fontSize:n.data.size||s,height:S.height,layer:S.layer,layerIndex:S.layerIndex,paths:n.data.paths,rotation:S.rotation,strokeColor:v,strokeThickness:v?n.data.strokeThickness:void 0,text:d,type:er.Textbox,vertical:n.data.vertical,verticalAlign:n.data.verticalAlign||"middle",width:S.width,x:S.left,y:S.top};if(c){const[R,O]=tf(n.data.size||s,c,S,[Ag(d,{vertical:n.data.vertical,uppercase:n.data.uppercase})],{size:n.data.size,minSize:n.data.minSize,maxSize:n.data.maxSize});console.log(`[handleTextStep] Creating autosized textbox element ${E.id}.`,{panelId:S.panelId,requestedFontSize:n.data.size||s,correctFontSize:R,lineCount:(O||[]).length}),i.push(new ai({...E,fontSize:R,text:E.curved?E.text:(O||[]).join(`
|
|
1899
|
-
`)},F))}else console.log(`[handleTextStep] Creating textbox element ${E.id} without font data.`,{panelId:S.panelId,fontSize:E.fontSize}),i.push(new ai(E,F))}return console.log(`[handleTextStep] Done with ${i.length} command(s).`),i},RI=async(r,e,t,n,i)=>{console.log("[generateCommands] Start.",{workflowId:e.id,designInputStepCount:r.length,designInputStepNames:r.map(s=>s.name),workflowStepCount:e.steps.length,layoutCount:t.length,layoutPanelIds:t.map(s=>s.panelId),productOverlayImageUrl:n});const a=[];i=i??{};for(const s of r){const o=e.steps.find(u=>u.stepName===s.name);if(!o){console.warn(`[generateCommands] No workflow step matching design input step "${s.name}"; skipping.`);continue}const l=a.length;switch(console.log(`[generateCommands] Handling step "${s.name}" of type ${o.type}.`),o.type){case Ye.DigitalContent:a.push(...await a9(t,s,o));break;case Ye.Frame:case Ye.Photo:a.push(...await s9(t,i,s,o));break;case Ye.Illustration:a.push(...await o9(t,i,s,o));break;case Ye.Module:a.push(...await l9(t,s,o));break;case Ye.Picture:a.push(...await u9(t,i,s,o));break;case Ye.Shape:a.push(...await c9(t,i,s,o));break;case Ye.Text:a.push(...await f9(t,i,s,o));break;default:console.warn(`[generateCommands] Unhandled step type ${o.type} for step "${s.name}"; no commands generated.`);break}console.log(`[generateCommands] Step "${s.name}" produced ${a.length-l} command(s). Running total: ${a.length}.`)}console.log("[generateCommands] Renderable steps done.",{commandCount:a.length,stepSelections:Object.fromEntries(Object.entries(i).map(([s,o])=>[s,JSON.stringify(o)]))});for(const s of e.steps){if(s.type!==Ye.SilentIllustration&&s.type!==Ye.ProductOverlay)continue;if(!await po(s,i)){console.log(`[generateCommands] Silent step "${s.stepName}" conditions not satisfied; skipping.`);continue}const o=a.length;console.log(`[generateCommands] Handling silent step "${s.stepName}" of type ${s.type}.`),a.push(...await d9(t,s,n)),console.log(`[generateCommands] Silent step "${s.stepName}" produced ${a.length-o} command(s). Running total: ${a.length}.`)}return console.log(`[generateCommands] Done with ${a.length} command(s).`),a},PE=["prepare","rasterize"],OI=()=>typeof performance<"u"?performance.now():Date.now(),
|
|
1899
|
+
`)},F))}else console.log(`[handleTextStep] Creating textbox element ${E.id} without font data.`,{panelId:S.panelId,fontSize:E.fontSize}),i.push(new ai(E,F))}return console.log(`[handleTextStep] Done with ${i.length} command(s).`),i},h9=async(r,e,t)=>{const n=e.data?.transactionId;n&&(r[t.stepName]={transactionId:n})},RI=async(r,e,t,n,i)=>{console.log("[generateCommands] Start.",{workflowId:e.id,designInputStepCount:r.length,designInputStepNames:r.map(s=>s.name),workflowStepCount:e.steps.length,layoutCount:t.length,layoutPanelIds:t.map(s=>s.panelId),productOverlayImageUrl:n});const a=[];i=i??{};for(const s of r){const o=e.steps.find(u=>u.stepName===s.name);if(!o){console.warn(`[generateCommands] No workflow step matching design input step "${s.name}"; skipping.`);continue}const l=a.length;switch(console.log(`[generateCommands] Handling step "${s.name}" of type ${o.type}.`),o.type){case Ye.DigitalContent:a.push(...await a9(t,s,o));break;case Ye.Frame:case Ye.Photo:a.push(...await s9(t,i,s,o));break;case Ye.Illustration:a.push(...await o9(t,i,s,o));break;case Ye.Module:a.push(...await l9(t,s,o));break;case Ye.Picture:a.push(...await u9(t,i,s,o));break;case Ye.Shape:a.push(...await c9(t,i,s,o));break;case Ye.Text:a.push(...await f9(t,i,s,o));break;case Ye.Product:await h9(i,s,o);break;default:console.warn(`[generateCommands] Unhandled step type ${o.type} for step "${s.name}"; no commands generated.`);break}console.log(`[generateCommands] Step "${s.name}" produced ${a.length-l} command(s). Running total: ${a.length}.`)}console.log("[generateCommands] Renderable steps done.",{commandCount:a.length,stepSelections:Object.fromEntries(Object.entries(i).map(([s,o])=>[s,JSON.stringify(o)]))});for(const s of e.steps){if(s.type!==Ye.SilentIllustration&&s.type!==Ye.ProductOverlay)continue;if(!await po(s,i)){console.log(`[generateCommands] Silent step "${s.stepName}" conditions not satisfied; skipping.`);continue}const o=a.length;console.log(`[generateCommands] Handling silent step "${s.stepName}" of type ${s.type}.`),a.push(...await d9(t,s,n)),console.log(`[generateCommands] Silent step "${s.stepName}" produced ${a.length-o} command(s). Running total: ${a.length}.`)}return console.log(`[generateCommands] Done with ${a.length} command(s).`),a},PE=["prepare","rasterize"],OI=()=>typeof performance<"u"?performance.now():Date.now(),p9=(r,e,t)=>{try{performance.measure?.(`spiff:layout-render:${r}`,{start:e,duration:t})}catch{}},DE=()=>OI(),RE=(r,e)=>{const t=OI()-e;return p9(r,e,t),t},g9=(r,e)=>{const t=PE.reduce((i,a)=>i+e[a],0),n=PE.map(i=>`${i}: ${e[i].toFixed(2)}ms`).join(" | ");console.debug(`[layout-render] ${r} - ${n} | total: ${t.toFixed(2)}ms`)};class m9{constructor(e){this.handleCompleteRender=null;const t=new Map;e.forEach(n=>t.set(n.id,new OE(n.id,n.name,this,{width:n.width,height:n.height},this.getWorkflowManager.bind(this),n))),this.layouts=t}setCompleteRenderCallback(e){this.handleCompleteRender=e,e(Array.from(this.layouts.values()))}onCompleteRender(){this.handleCompleteRender&&this.handleCompleteRender(Array.from(this.layouts.values()))}getAll(){return this.layouts}setWorkflowManager(e){this.workflowManager=e}getWorkflowManager(){return this.workflowManager}updateLayouts(e){const t=new Map(this.layouts),n=new Map;for(const i of e){const a=Array.from(t.values()).find(s=>s.getLayout()?.panelId===i.panelId);if(a)a.updateLayout(i),n.set(i.id,a);else{const s=new OE(i.id,i.name,this,{width:i.width,height:i.height},this.getWorkflowManager.bind(this),i);n.set(i.id,s)}}this.layouts=n}}const y9=()=>new Promise((r,e)=>{try{const n=Fo().getContext("webgl2");r(!!n)}catch{r(!1)}}),BI=y9();class OE{constructor(e,t,n,i,a,s){this.hasSetStaticContext=!1,this.interactiveDirty=!1,this.staticCtxDirty=!1,this.lastRequestedRenderArguments=void 0,this.lastCompletedStaticRender=void 0,this.renderQueue=new Xg(2),this.id=e,this.name=t,this.service=n,this.panelSize=i,this.getWorkflowManager=a,this.layout=s}getID(){return this.id}getName(){return this.name}getPanelSize(){return this.panelSize}getLayout(){return this.layout}updateLayout(e){this.layout=e,this.name=e.name,this.panelSize={width:e.width,height:e.height},this.setStaticContextDirty(!0)}getStaticContext(){return this.textureCtx}setStaticContext(e){this.textureCtx=e,this.lastRequestedRenderArguments&&this.render(this.lastRequestedRenderArguments)}getStaticContextDirty(){return this.staticCtxDirty}setStaticContextDirty(e){this.staticCtxDirty=e}getInteractiveCanvasDirty(){return this.interactiveDirty}setInteractiveCanvasDirty(e){this.interactiveDirty=e}markLastCompletedStaticRender(){this.lastCompletedStaticRender=Date.now(),this.service.onCompleteRender()}getLastCompletedStaticRender(){return this.lastCompletedStaticRender}requestRerender(){this.lastRequestedRenderArguments&&this.render(this.lastRequestedRenderArguments)}async render(e){const t=Ao(e);this.lastRequestedRenderArguments=t;const n=this.getStaticContext();if(!n){this.markLastCompletedStaticRender(),this.setStaticContextDirty(!1);return}this.renderQueue.enqueue(new v9(this.getID(),n,await BI,()=>{this.markLastCompletedStaticRender(),this.setStaticContextDirty(!0)},t,this.getWorkflowManager))}}class v9 extends Yg{constructor(e,t,n,i,a,s){super(),this.layoutId=e,this.ctx=t,this.nonPOTSupport=n,this.onRender=i,this.layouts=a,this.getWorkflowManager=s}async execute(){const e=this.layouts.find(h=>h.layoutState.layout.id===this.layoutId);if(!e)return;const t=e.layoutState.elements||[],n=e.layoutState.layout.width,i=e.layoutState.layout.height,{width:a,height:s}=MI(n,i,this.nonPOTSupport),o=this.getWorkflowManager?.()?.getTemplatingContext(),l={};let u=DE();const c=Zg(e.layoutState.layout,t,{renderingConfiguration:{purpose:tc.ThreeD,templatingContext:o}}),f=iT(c),d=await ho.from(this.ctx,f,{anonymousCrossOrigin:!0,ignoreDimensions:!this.nonPOTSupport,ignoreAnimation:!0,ignoreClear:!0,ignoreMouse:!0,enableRedraw:!1,createCanvas:Fo,createImage:Uf,DOMParser:i1(),fetch});l.prepare=RE("prepare",u),u=DE(),d.resize(a,s),await d.render(),l.rasterize=RE("rasterize",u),g9(this.layoutId,l),this.onRender()}}function MI(r,e,t){const n=r===1||e===1?{width:1,height:1}:A9(),i=n.width,a=n.height;let s,o;if(t){const l=i/a;r/e<l?(s=i,o=e*(i/r)):(s=r*(a/e),o=a);const c=x9({width:s,height:o});s=c.width,o=c.height}else s=n.width,o=n.height;return{width:s,height:o}}function A9(){return b9()||!w9()?{width:1024,height:1024}:{width:2048,height:2048}}function b9(){return window.innerWidth<=480}function w9(){return navigator.userAgent.includes("SamsungBrowser")?!1:!!window.Worker&&!!window.OffscreenCanvas}function x9(r,e=4096){const t=e/r.width,n=e/r.height,i=Math.min(t,n);return i>1?r:{width:r.width*i,height:r.height*i}}const C9=(r,e)=>{const t=[];return r.forEach(n=>{const i=e.steps.find(a=>a.stepName===n.stepName);i?.type===Ye.Text&&n.stepAspectType==="Text"&&t.push({name:i.stepName,data:{text:n.value}})}),t},S9=async(r,e,t,n)=>{let i={serializableWorkflow:{steps:[]},layouts:{}};i=new In(t.map(l=>new _1(l))).apply(i);const s=await RI(r,e,t,n);return new In(s).apply(i)},em=Ce`
|
|
1900
1900
|
fragment GlobalPropertyStateAspectFields on GlobalPropertyStateAspect {
|
|
1901
1901
|
name
|
|
1902
1902
|
value
|
|
@@ -1919,7 +1919,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
1919
1919
|
}
|
|
1920
1920
|
}
|
|
1921
1921
|
}
|
|
1922
|
-
`,
|
|
1922
|
+
`,E9=Ce`
|
|
1923
1923
|
${em}
|
|
1924
1924
|
mutation CreateGlobalPropertyState($bundleId: String!) {
|
|
1925
1925
|
globalPropertyStateCreate(bundleId: $bundleId) {
|
|
@@ -1929,7 +1929,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
1929
1929
|
}
|
|
1930
1930
|
}
|
|
1931
1931
|
}
|
|
1932
|
-
`,
|
|
1932
|
+
`,k9=Ce`
|
|
1933
1933
|
${em}
|
|
1934
1934
|
mutation UpdateGlobalPropertyState($id: String!, $aspects: [GlobalPropertyStateAspectInput]!) {
|
|
1935
1935
|
globalPropertyStateUpdate(id: $id, aspects: $aspects) {
|
|
@@ -1939,7 +1939,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
1939
1939
|
}
|
|
1940
1940
|
}
|
|
1941
1941
|
}
|
|
1942
|
-
`,
|
|
1942
|
+
`,T9=Ce`
|
|
1943
1943
|
${em}
|
|
1944
1944
|
query GetGlobalPropertyState($bundleId: String!) {
|
|
1945
1945
|
globalPropertyState(bundleId: $bundleId) {
|
|
@@ -1949,7 +1949,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
1949
1949
|
}
|
|
1950
1950
|
}
|
|
1951
1951
|
}
|
|
1952
|
-
`,
|
|
1952
|
+
`,F9=async r=>(await Le.getShadowGraphqlClient().query({query:T9,fetchPolicy:"cache-first",errorPolicy:"all",variables:{bundleId:r}})).data.globalPropertyState,I9=Ce`
|
|
1953
1953
|
fragment WorkflowProductFields on WorkflowProduct {
|
|
1954
1954
|
id
|
|
1955
1955
|
index
|
|
@@ -1958,8 +1958,8 @@ Minimum version required to store current data is: `+U+`.
|
|
|
1958
1958
|
workflowName
|
|
1959
1959
|
imageUrl
|
|
1960
1960
|
}
|
|
1961
|
-
`,
|
|
1962
|
-
${
|
|
1961
|
+
`,P9=r=>Ce`
|
|
1962
|
+
${I9}
|
|
1963
1963
|
${$f}
|
|
1964
1964
|
fragment ProductFields on Product {
|
|
1965
1965
|
id
|
|
@@ -2010,7 +2010,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2010
2010
|
}
|
|
2011
2011
|
}
|
|
2012
2012
|
`,G1=r=>Ce`
|
|
2013
|
-
${
|
|
2013
|
+
${P9(r)}
|
|
2014
2014
|
fragment ProductCollectionProductFields on ProductCollectionProduct {
|
|
2015
2015
|
id
|
|
2016
2016
|
productId
|
|
@@ -2053,7 +2053,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2053
2053
|
}
|
|
2054
2054
|
}
|
|
2055
2055
|
}
|
|
2056
|
-
`,
|
|
2056
|
+
`,D9=Ce`
|
|
2057
2057
|
${j1}
|
|
2058
2058
|
query GetGlobalPropertyConfigurations($ids: [String!]!) {
|
|
2059
2059
|
globalPropertyConfigurations(ids: $ids) {
|
|
@@ -2117,7 +2117,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2117
2117
|
workflowViewerLink
|
|
2118
2118
|
workflowViewerAmendLink
|
|
2119
2119
|
}
|
|
2120
|
-
`,
|
|
2120
|
+
`,R9=r=>Ce`
|
|
2121
2121
|
${em}
|
|
2122
2122
|
${tm(r)}
|
|
2123
2123
|
${_I}
|
|
@@ -2145,6 +2145,9 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2145
2145
|
productCollection {
|
|
2146
2146
|
...ProductCollectionFields
|
|
2147
2147
|
}
|
|
2148
|
+
globalPropertyConfiguration {
|
|
2149
|
+
...GlobalPropertyConfigurationFields
|
|
2150
|
+
}
|
|
2148
2151
|
transactionIds
|
|
2149
2152
|
bundleShareActions {
|
|
2150
2153
|
id
|
|
@@ -2201,7 +2204,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2201
2204
|
}
|
|
2202
2205
|
}
|
|
2203
2206
|
}
|
|
2204
|
-
`,
|
|
2207
|
+
`,O9=Ce`
|
|
2205
2208
|
query GetBundlesForCustomer($id: String!) {
|
|
2206
2209
|
customers(ids: [$id]) {
|
|
2207
2210
|
bundleStakeholders {
|
|
@@ -2240,7 +2243,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2240
2243
|
}
|
|
2241
2244
|
}
|
|
2242
2245
|
}
|
|
2243
|
-
`,
|
|
2246
|
+
`,B9=Ce`
|
|
2244
2247
|
query GetProductCollectionForFilteredProducts(
|
|
2245
2248
|
$id: String!
|
|
2246
2249
|
$productFilters: ProductCollectionProductFilterInput
|
|
@@ -2269,7 +2272,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2269
2272
|
}
|
|
2270
2273
|
}
|
|
2271
2274
|
}
|
|
2272
|
-
`,
|
|
2275
|
+
`,M9=Ce`
|
|
2273
2276
|
${G1(!0)}
|
|
2274
2277
|
query GetProductCollectionForProductsFeed(
|
|
2275
2278
|
$id: String!
|
|
@@ -2301,7 +2304,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2301
2304
|
}
|
|
2302
2305
|
}
|
|
2303
2306
|
}
|
|
2304
|
-
`,
|
|
2307
|
+
`,_9=r=>Ce`
|
|
2305
2308
|
${tm(r)}
|
|
2306
2309
|
${_I}
|
|
2307
2310
|
mutation CreateBundle(
|
|
@@ -2339,7 +2342,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2339
2342
|
}
|
|
2340
2343
|
}
|
|
2341
2344
|
}
|
|
2342
|
-
`,
|
|
2345
|
+
`,N9=()=>Ce`
|
|
2343
2346
|
mutation DuplicateBundle(
|
|
2344
2347
|
$id: String!
|
|
2345
2348
|
$template: Boolean
|
|
@@ -2384,19 +2387,19 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2384
2387
|
id
|
|
2385
2388
|
}
|
|
2386
2389
|
}
|
|
2387
|
-
`,
|
|
2390
|
+
`,L9=Ce`
|
|
2388
2391
|
mutation BundleAddTransaction($id: String!, $transactionId: String!) {
|
|
2389
2392
|
bundleAddTransaction(id: $id, transactionId: $transactionId) {
|
|
2390
2393
|
id
|
|
2391
2394
|
}
|
|
2392
2395
|
}
|
|
2393
|
-
`,
|
|
2396
|
+
`,U9=Ce`
|
|
2394
2397
|
mutation BundleAddTransactions($id: String!, $transactionIds: [String!]!, $transactionOwnerIds: [String!]) {
|
|
2395
2398
|
bundleAddTransactions(id: $id, transactionIds: $transactionIds, transactionOwnerIds: $transactionOwnerIds) {
|
|
2396
2399
|
id
|
|
2397
2400
|
}
|
|
2398
2401
|
}
|
|
2399
|
-
`,
|
|
2402
|
+
`,V9=Ce`
|
|
2400
2403
|
mutation BundleRemoveTransaction(
|
|
2401
2404
|
$id: String!
|
|
2402
2405
|
$transactionId: String!
|
|
@@ -2411,7 +2414,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2411
2414
|
id
|
|
2412
2415
|
}
|
|
2413
2416
|
}
|
|
2414
|
-
|
|
2417
|
+
`,$9=Ce`
|
|
2415
2418
|
mutation BundleRemoveTransactions(
|
|
2416
2419
|
$id: String!
|
|
2417
2420
|
$transactionIds: [String!]!
|
|
@@ -2426,7 +2429,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2426
2429
|
id
|
|
2427
2430
|
}
|
|
2428
2431
|
}
|
|
2429
|
-
|
|
2432
|
+
`,z9=Ce`
|
|
2430
2433
|
mutation BundleAddStakeholder($id: String!, $details: CustomerDetailsInput!, $type: String!) {
|
|
2431
2434
|
bundleAddStakeholder(id: $id, details: $details, type: $type) {
|
|
2432
2435
|
id
|
|
@@ -2446,13 +2449,13 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2446
2449
|
}
|
|
2447
2450
|
}
|
|
2448
2451
|
}
|
|
2449
|
-
`,
|
|
2452
|
+
`,H9=Ce`
|
|
2450
2453
|
mutation BundleAddStakeholder($id: String!, $emailAddress: String!) {
|
|
2451
2454
|
bundleRemoveStakeholder(id: $id, emailAddress: $emailAddress) {
|
|
2452
2455
|
id
|
|
2453
2456
|
}
|
|
2454
2457
|
}
|
|
2455
|
-
`,
|
|
2458
|
+
`,G9=Ce`
|
|
2456
2459
|
mutation BundleUpdateStakeholders($id: String!, $input: [BundleStakeholderInput!]!) {
|
|
2457
2460
|
bundleUpdateStakeholders(id: $id, input: $input) {
|
|
2458
2461
|
id
|
|
@@ -2472,13 +2475,13 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2472
2475
|
}
|
|
2473
2476
|
}
|
|
2474
2477
|
}
|
|
2475
|
-
`,
|
|
2478
|
+
`,j9=Ce`
|
|
2476
2479
|
mutation BundleUpdateTransactionOrder($id: String!, $transactionIds: [String!]!) {
|
|
2477
2480
|
bundleUpdateTransactionOrder(id: $id, transactionIds: $transactionIds) {
|
|
2478
2481
|
id
|
|
2479
2482
|
}
|
|
2480
2483
|
}
|
|
2481
|
-
`,
|
|
2484
|
+
`,q9=r=>Ce`
|
|
2482
2485
|
${tm(r)}
|
|
2483
2486
|
mutation BundleAssignProductCollection($id: String!, $productCollectionId: String!) {
|
|
2484
2487
|
bundleAssignProductCollection(id: $id, collectionId: $productCollectionId) {
|
|
@@ -2488,13 +2491,13 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2488
2491
|
}
|
|
2489
2492
|
}
|
|
2490
2493
|
}
|
|
2491
|
-
`,
|
|
2494
|
+
`,W9=Ce`
|
|
2492
2495
|
mutation AssignGlobalPropertyConfiguration($bundleId: String!, $globalPropertyConfigurationId: String!) {
|
|
2493
2496
|
bundleUpdate(id: $bundleId, globalPropertyConfigurationId: $globalPropertyConfigurationId) {
|
|
2494
2497
|
id
|
|
2495
2498
|
}
|
|
2496
2499
|
}
|
|
2497
|
-
`,
|
|
2500
|
+
`,Q9=r=>Ce`
|
|
2498
2501
|
${NI}
|
|
2499
2502
|
query CustomerBundlesFeed($id: String!, $limit: Int!, $offset: Int!, $template: Boolean, $templateStatus: BundleTemplateStatus, $ordered: Boolean) {
|
|
2500
2503
|
customerBundlesFeed(id: $id, limit: $limit, offset: $offset, template: $template, templateStatus: $templateStatus, ordered: $ordered) {
|
|
@@ -2526,27 +2529,27 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2526
2529
|
total
|
|
2527
2530
|
}
|
|
2528
2531
|
}
|
|
2529
|
-
`,
|
|
2532
|
+
`,Y9=Ce`
|
|
2530
2533
|
mutation FinalizeUpdateBundle($bundleId: String!) {
|
|
2531
2534
|
bundleFinalizeUpdate(bundleId: $bundleId)
|
|
2532
2535
|
}
|
|
2533
|
-
`,
|
|
2536
|
+
`,X9=Ce`
|
|
2534
2537
|
mutation ApproveBundle($id: String!, $note: String, $stakeholderId: String) {
|
|
2535
2538
|
bundleApprove(id: $id, note: $note, stakeholderId: $stakeholderId)
|
|
2536
2539
|
}
|
|
2537
|
-
`,
|
|
2540
|
+
`,J9=Ce`
|
|
2538
2541
|
mutation RejectBundle($id: String!, $note: String, $stakeholderId: String) {
|
|
2539
2542
|
bundleReject(id: $id, note: $note, stakeholderId: $stakeholderId)
|
|
2540
2543
|
}
|
|
2541
|
-
`,
|
|
2544
|
+
`,K9=Ce`
|
|
2542
2545
|
mutation ApproveTransaction($id: String!, $note: String) {
|
|
2543
2546
|
transactionApprove(id: $id, note: $note)
|
|
2544
2547
|
}
|
|
2545
|
-
`,
|
|
2548
|
+
`,Z9=Ce`
|
|
2546
2549
|
mutation RejectTransaction($id: String!, $note: String) {
|
|
2547
2550
|
transactionReject(id: $id, note: $note)
|
|
2548
2551
|
}
|
|
2549
|
-
`,
|
|
2552
|
+
`,eV=Ce`
|
|
2550
2553
|
mutation CreateRecipient(
|
|
2551
2554
|
$firstName: String
|
|
2552
2555
|
$lastName: String
|
|
@@ -2588,7 +2591,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2588
2591
|
id
|
|
2589
2592
|
}
|
|
2590
2593
|
}
|
|
2591
|
-
`,
|
|
2594
|
+
`,tV=Ce`
|
|
2592
2595
|
mutation UpdateRecipient(
|
|
2593
2596
|
$id: String!
|
|
2594
2597
|
$firstName: String
|
|
@@ -2634,17 +2637,17 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2634
2637
|
id
|
|
2635
2638
|
}
|
|
2636
2639
|
}
|
|
2637
|
-
`,
|
|
2640
|
+
`,rV=Ce`
|
|
2638
2641
|
mutation AtttachRecipient($id: String!, $recipientId: String!) {
|
|
2639
2642
|
transactionAttachRecipient(id: $id, recipientId: $recipientId) {
|
|
2640
2643
|
id
|
|
2641
2644
|
}
|
|
2642
2645
|
}
|
|
2643
|
-
`,
|
|
2646
|
+
`,nV=Ce`
|
|
2644
2647
|
mutation DeleteBundle($id: String!) {
|
|
2645
2648
|
bundleDelete(id: $id)
|
|
2646
2649
|
}
|
|
2647
|
-
`,
|
|
2650
|
+
`,iV=Ce`
|
|
2648
2651
|
query FindBundleForTransactions($ids: [String!]!) {
|
|
2649
2652
|
transactions(ids: $ids) {
|
|
2650
2653
|
id
|
|
@@ -2653,13 +2656,13 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2653
2656
|
}
|
|
2654
2657
|
}
|
|
2655
2658
|
}
|
|
2656
|
-
`,
|
|
2659
|
+
`,aV=Ce`
|
|
2657
2660
|
mutation EmailBundleShareLink($bundleId: String!, $email: String!, $firstName: String, $lastName: String) {
|
|
2658
2661
|
bundleEmailSharePageLink(bundleId: $bundleId, email: $email, firstName: $firstName, lastName: $lastName) {
|
|
2659
2662
|
id
|
|
2660
2663
|
}
|
|
2661
2664
|
}
|
|
2662
|
-
`,aV=(r,e)=>e&&typeof e=="object"&&!Array.isArray(e)?Object.keys(e).sort().reduce((t,n)=>(t[n]=e[n],t),{}):e,sV=r=>{for(const e of Object.values(r.layouts).map(t=>t.elements).flat())e.type==="illustration"&&(delete e.cachedObjectURL,e.src&&delete e.svg),e.type==="frame"&&delete e.pattern?.svg;return LI(r,"__typename"),r},LI=(r,e)=>{if(!(typeof r!="object"||r===null))for(const t in r)t===e?delete r[t]:LI(r[t],e)};var eh=(r=>(r.Error="Error",r.Warning="Warning",r.Info="Info",r))(eh||{});const oV=1e3;class _E extends Yg{constructor(e){super(),this.update=e}async execute(){await this.update(),await new Promise(e=>{window.setTimeout(()=>{e()},oV)})}}const lV=r=>r.sort((e,t)=>e.index-t.index).map(e=>({id:Ar(),panelId:e.name,name:e.name,title:e.title,index:e.index,createdAt:new Date,updatedAt:new Date,transparentBackground:e.transparentBackground,height:e.height,width:e.width,previewRegion:e.previewRegion,useEditableArea:e.useEditableArea,editableArea:e.editableArea})),NE=(r,e)=>{const t=r.workflowState,n=t?JSON.parse(t):void 0;return n?Object.values(n.layouts).map(i=>i.layout):lV(e.panels)},lf=class lf{constructor(e,t,n,i,a,s=!1,o,l=!1,u=!1,c=!1){this.workflowStatePromiseQueue=new Xg(1),this.initialized=!1,this.readOnly=!1,this.isReloadedTransaction=!1,this.singleVariantsRenderable=!1,this.stepTags={},this.setWorkflow=async d=>{this.confirmedDesign=!1,this.editedSteps={},this.informationResults=[],this.mandatorySteps={},this.pendingUpdates=[],this.selectionCost=0,this.stepSpecificServices={},this.pollers=[],this.allScenes=[],this.stepElements={},this.stepInitialised={},this.stepMetadata={},this.stepSelections={},this.storage={},this.validationErrors={steps:new Map},this.currentAdjustingStepId="",this.reloadedState?this.layouts=Object.values(this.reloadedState.layouts||{}).map(g=>g.layout):d?this.layouts=NE(this.experience.getTransaction(),d):this.layouts=[],this.commandContext.initialize(this.layouts,this.reloadedState),this.renderableContextService=new g9(this.layouts),this.renderableContextService.setWorkflowManager(this),d.steps.forEach(g=>{this.stepTags[g.stepName]=g.tags??[]});const h=this.previewService;this.ejectFromPreviewService(),this.initializationPromise=this.initializeDefaultWorkflowState(d),this.initializationPromise.then(()=>{this.initialized=!0}),this.initializationPromise.catch(g=>{throw this.initialized=!1,new Error(g)}),this.initializationPromise.finally(()=>this.commandContext.registerStateCallback(()=>{this.updateStateWithServer(),this.debouncedRenderLayouts()})),h&&await this.injectIntoPreviewService(h,!0)},this.renderLayouts=()=>{const d=this.getLayoutPreviewService()?.getAll();if(!d)return;const h=this.getCommandContext().getAllLayouts();for(const[,g]of d)g.render(h)},this.debouncedRenderLayouts=v1(()=>this.renderLayouts(),150),this.experience=e,this.client=t,this.updateTransaction=n,this.graphQlClient=i,this.reloadedState=a,this.readOnly=s,this.singleVariantsRenderable=u,this.commandContext=new gI,this.confirmCallbacks=[],this.editedCallbacks=[],this.elementsCallbacks=[],this.informationResultCallbacks=[],this.initCallbacks=[],this.mandatoryCallbacks=[],this.makingAdjustmentsCallback=[],this.metadataCallbacks=[],this.selectionCallbacks=[],this.stepSpecificStorageCallbacks={},this.storageCallbacks=[],this.validationCallbacks=[],this.recipientCallbacks=[],this.modelContainer=o,this.confirmedDesign=!1,this.editedSteps={},this.informationResults=[],this.mandatorySteps={},this.pendingUpdates=[],this.selectionCost=0,this.stepSpecificServices={},this.pollers=[],this.allScenes=[],this.stepElements={},this.stepInitialised={},this.stepMetadata={},this.stepSelections={},this.storage={},this.validationErrors={steps:new Map},this.currentAdjustingStepId="",this.isReloadedTransaction=l,c&&(this.workflowStatePromiseQueue.enabled=!1);const f=this.experience.getWorkflow();f&&this.setWorkflow(f)}async updateWorkflowConfiguration(e){e.panels&&await this.updatePanels(e.panels),e.steps&&await this.updateSteps(e.steps),this.allScenes=D0(this.getWorkflowExperience().getWorkflow()),await this.ensureStepsAreLoaded(),this.renderLayouts(),await this.onSelectionChange()}async updatePanels(e){const t=this.experience.getWorkflow();let n=[...t.panels];if(e.removed&&(n=n.filter(o=>!e.removed.includes(o.name))),e.changed)for(const o of e.changed){const l=n.findIndex(u=>u.name===o.name);l>=0&&(n[l]=o)}if(e.added)for(const{item:o,index:l}of e.added)n.splice(l,0,o);const i=new Map(this.layouts.map(o=>[o.panelId,o])),a=NE(this.experience.getTransaction(),{...t,panels:n}),s=new Map;for(const o of a){const l=i.get(o.panelId);l?s.set(l.id,{...l,...o,id:l.id}):s.set(o.id,o)}this.layouts=Array.from(s.values()),this.commandContext.updateLayouts(this.layouts),this.renderableContextService&&this.renderableContextService.updateLayouts(this.layouts)}async updateSteps(e){if(e.removed)for(const t of e.removed)this.clearStepState(t);if(e.changed)for(const t of e.changed)this.clearStepState(t.stepName)}clearStepState(e){const t=this.stepElements[e];if(t&&t.length>0){const n=t.map(i=>new Oo(i.id));n.length>0&&this.commandContext.apply(new In(n),!0)}delete this.stepSelections[e],delete this.stepMetadata[e],delete this.storage[e],delete this.stepElements[e],delete this.stepInitialised[e],delete this.stepSpecificServices[e],delete this.mandatorySteps[e],this.validationErrors.steps.delete(e)}getTemplatingContext(){const e=this.experience.getTransaction().recipient,t={recipient:e};return this.recipientConversionConfiguration?.requestedDataItems?.forEach(n=>{const i=n.uniqueIdentifier??n.title??"";n.type===Kd.FirstName?t[i]=e?.firstName:n.type===Kd.LastName?t[i]=e?.lastName:n.type===Kd.Custom&&(n.customFieldIndex===1?t[i]=e?.customField1:n.customFieldIndex===2?t[i]=e?.customField2:n.customFieldIndex===3?t[i]=e?.customField3:n.customFieldIndex===4?t[i]=e?.customField4:n.customFieldIndex===5&&(t[i]=e?.customField5),n.option&&(t[i]=n.option.variants?.find(a=>a.id===t[i])?.name))}),t}async updateRecipient(e,t,n,i,a,s,o,l,u,c,f,d,h,g,y,v,A,x){const S=this.experience.getTransaction();if(S.recipient?.id)this.experience.getTransaction().recipient={id:S.recipient.id,firstName:e??S.recipient.firstName,lastName:t??S.recipient.lastName,address:n??S.recipient.address,suburb:i??S.recipient.suburb,state:a??S.recipient.state,email:s??S.recipient.email,postalCode:o??S.recipient.postalCode,country:l??S.recipient.country,mobile:u??S.recipient.mobile,company:c??S.recipient.company,apartment:f??S.recipient.apartment,customField1:d??S.recipient.customField1,customField2:h??S.recipient.customField2,customField3:g??S.recipient.customField3,customField4:y??S.recipient.customField4,customField5:v??S.recipient.customField5,conversionConfigurationId:A||S.recipient.conversionConfigurationId},this.experience.callEvent(Cg.RecipientChanged),await this.graphQlClient().mutate({mutation:eV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:S.recipient.id,firstName:e||S.recipient.firstName,lastName:t||S.recipient.lastName,address:n||S.recipient.address,suburb:i||S.recipient.suburb,state:a||S.recipient.state,email:s||S.recipient.email,postalCode:o||S.recipient.postalCode,country:l||S.recipient.country,mobile:u||S.recipient.mobile,company:c||S.recipient.company,apartment:f||S.recipient.apartment,customField1:d||S.recipient.customField1,customField2:h||S.recipient.customField2,customField3:g||S.recipient.customField3,customField4:y||S.recipient.customField4,customField5:v||S.recipient.customField5,conversionConfigurationId:A||S.recipient.conversionConfigurationId,prevalidated:x}});else{const F=await this.graphQlClient().mutate({mutation:Z9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{firstName:e,lastName:t,address:n,suburb:i,state:a,email:s,postalCode:o,country:l,mobile:u,company:c,apartment:f,customField1:d,customField2:h,customField3:g,customField4:y,customField5:v,conversionConfigurationId:A}});S.recipient={id:F?.data?.recipientCreate?.id,firstName:e,lastName:t,address:n,suburb:i,state:a,email:s,postalCode:o,country:l,mobile:u,company:c,apartment:f,customField1:d,customField2:h,customField3:g,customField4:y,customField5:v,conversionConfigurationId:A},this.experience.callEvent(Cg.RecipientChanged),await this.graphQlClient().mutate({mutation:tV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.experience.getTransaction().id,recipientId:F.data?.recipientCreate?.id},context:{transactionOwnerId:this.experience.getTransaction().transactionOwnerId}})}await this.fetchConversionConfiguration(),this.recipientCallbacks.forEach(F=>F(this.experience.getTransaction().recipient))}async fetchConversionConfiguration(){const e=this.experience.getTransaction().recipient;if(e?.conversionConfigurationId&&!this.recipientConversionConfiguration){const t=lf.configurationPromiseMap.get(e.conversionConfigurationId);if(t)this.recipientConversionConfiguration=await t;else{const i=(async()=>(await this.graphQlClient().query({query:nM,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e.conversionConfigurationId}})).data.conversionConfiguration)();lf.configurationPromiseMap.set(e.conversionConfigurationId,i),this.recipientConversionConfiguration=await i}}}async initializeDefaultWorkflowState(e){const t=()=>{const c=e.finalizeStepConfig;if(!c)return;const f=c.lookAtAnimation,d=c.modelAnimation;f&&this.previewService?.executeCameraAnimation(f),d&&this.modelContainer?.executeAnimation(d)};this.reloadedState&&this.reloadedState.serializableWorkflow.steps.forEach(c=>{this.storage[c.stepName]=c.storage||{}});const n=await this.getInitialOptionIds(this.reloadedState?.serializableWorkflow?.steps.reduce((c,f)=>(f.selectedVariants?.length&&(c[f.stepName]={selectedVariants:f.selectedVariants.map(d=>({id:d.id}))}),c),{})),i=ct.getOptions(Array.from(n)),a=this.fetchConversionConfiguration();await Promise.all([i,a]),this.allScenes=D0(e);const o=(await Za(this.allScenes,this.stepSelections)).map(c=>c.silentSteps).flat(),{stepElements:l,commands:u}=await this.stepElementsForIntroducedSilentSteps(o,!!this.reloadedState);this.commandContext.apply(new In(u),!0),this.stepElements={...this.stepElements,...l},await this.ensureStepsAreLoaded(),this.isReloadedTransaction||this.updateStateWithServer(),this.renderLayouts(),this.reloadedState&&t()}getWorkflowExperience(){return this.experience}getClient(){return this.client}setWorkflowStateSyncEnabled(e){this.workflowStatePromiseQueue.enabled=e}getInitializationPromise(){return this.initializationPromise}isInitialized(){return this.initialized}async getInitialOptionIds(e){const t=new Set,n=this.experience.getWorkflow();if(!n)return t;const i=D0(n),a={...e};let s=-1;for(;;){const u=(await Za(i,a)).flatMap(c=>c.renderableSteps);if(u.length===s)break;s=u.length;for(const c of u){if(a[c.stepName])continue;const f=c.option?.defaultVariant?.id;f&&(a[c.stepName]={selectedVariants:[{id:f}]})}}return(await Za(i,a)).flatMap(l=>l.renderableSteps).forEach(l=>{l.option?.id&&!l.option?.variants&&t.add(l.option.id)}),t}addConfirmCallback(e){e(this.confirmedDesign),this.confirmCallbacks.push(e)}addEditedCallback(e){e(this.editedSteps),this.editedCallbacks.push(e)}addElementsCallback(e){e(this.stepElements),this.elementsCallbacks.push(e)}addInformationResultCallback(e){e(this.informationResults),this.informationResultCallbacks.push(e)}addInitCallback(e){e(this.stepInitialised),this.initCallbacks.push(e)}addMandatoryCallback(e){e(this.mandatorySteps),this.mandatoryCallbacks.push(e)}addMetadataCallback(e){e(this.stepMetadata),this.metadataCallbacks.push(e)}async addSelectionCallback(e){e({selectionCost:this.selectionCost,selections:this.stepSelections,traversableScenes:await this.traversableScenes()}),this.selectionCallbacks.push(e)}addStepSpecificStorageCallback(e,t){Object.keys(this.storage).includes(t)||(this.storage[t]={}),e(this.storage[t]),Object.keys(this.stepSpecificStorageCallbacks).includes(t)||(this.stepSpecificStorageCallbacks[t]=[]),this.stepSpecificStorageCallbacks[t].push(e)}addStorageCallback(e){e(this.storage),this.storageCallbacks.push(e)}addMakingAdjustmentsCallback(e){e(this.currentAdjustingStepId),this.makingAdjustmentsCallback.push(e)}addPoller(e){this.pollers.push(e)}addValidationCallback(e){this.validationCallbacks.push(e),e(this.validationErrors)}addRecipientCallback(e){this.recipientCallbacks.push(e),e(this.experience.getTransaction().recipient)}removeRecipientCallback(e){this.recipientCallbacks=this.recipientCallbacks.filter(t=>t!==e)}getLayouts(){return this.layouts}getAllLayoutData(){return this.commandContext.getAllLayouts().map(e=>e.layoutState)}getLayoutPreviewService(){return this.renderableContextService}getInformationResults(){return this.informationResults}getPreviewService(){return this.previewService}getCommandContext(){return this.commandContext}getRegionElements(e){return this.stepElements[e]||[]}getStepSpecificServices(e){return this.stepSpecificServices[e]}getTransactionCustomer(){return this.ownerCustomer}setTransactionCustomer(e){this.ownerCustomer=e}setTransactionCustomerDetails(e){this.ownerCustomer={...this.ownerCustomer,emailAddress:e.email}}getModelContainer(){return this.modelContainer}setModelContainer(e){(!e||this.previewService&&this.previewService.getAllModels().includes(e))&&(this.modelContainer=e,e&&e.metadata&&e.metadata instanceof Map&&this.modelContainer.metadata.set("workflowManager",this))}getCommandDispatcher(){return e=>this.commandContext.apply(e,!this.initialized)}getWorkflowSelections(){const e={};return this.experience.getWorkflow()?.steps.forEach(t=>{const n=this.stepSelections[t.stepName];n&&n.selectedVariants&&n.selectedVariants.length>0&&(e[t.stepName]={selections:n.selectedVariants})}),e}getStepSelections(){return this.stepSelections}markStepsAsInitialised(e){const t={...this.stepInitialised};e.forEach(n=>{t[n]=!0}),this.stepInitialised=t,this.onInitChange()}getUpdatesPending(){return this.pendingUpdates.length>0}markUpdateCompleted(e){this.pendingUpdates=this.pendingUpdates.filter(t=>t!==e)}markUpdatePending(){const e=Ar();return this.pendingUpdates=[...this.pendingUpdates,e],e}setEditedStatus(e,t){this.editedSteps={...this.editedSteps,[e]:t},this.onEditedChange()}setInformationResults(e){this.informationResults=[...e],this.onInformationResultChange()}setCurrentAdjustingStepId(e){this.currentAdjustingStepId=e,this.onMakingAdjustmentsChange()}setMandatoryFulfilled(e,t){this.mandatorySteps[e]!==t&&(this.mandatorySteps={...this.mandatorySteps,[e]:t},this.onMandatoryChange())}async getMandatoryUnfulfilledSteps(){return(await Za(this.allScenes,this.stepSelections)).flatMap(a=>a.renderableSteps).filter(a=>a.mandatory).filter(a=>!this.mandatorySteps[a.stepName]).map(a=>a.stepName)}setStepError(e,t,n){let i=!1;if(!this.validationErrors.steps.has(e)&&n)i=!0,this.validationErrors.steps.set(e,new Map([[t,n]]));else if(this.validationErrors.steps.has(e)){const a=this.validationErrors.steps.get(e);n&&n!==a.get(t)?(i=!0,a.set(t,n)):n||(i=!0,a.delete(t),a.size===0&&this.validationErrors.steps.delete(e))}i&&this.onValidationChange()}getStepErrors(e){return this.validationErrors.steps.get(e)}getValidationErrors(){return this.validationErrors}toggleDesignConfirmed(){this.confirmedDesign=!this.confirmedDesign,this.onConfirmChange()}toggleMakingAdjustmentsCallback(e){e(this.mandatorySteps),this.mandatoryCallbacks.push(e)}async injectIntoPreviewService(e,t){if(this.modelContainer)throw new Error("You must eject from the preview service before injecting again.");this.previewService=e;const n=this.experience.getProduct();if(!n?.modelUrl||!this.previewService)return;const i=e.loadModel({model:n.modelUrl,contextService:this.getLayoutPreviewService()},{refocusCamera:t});this.setModelContainer(i),(await Za(this.allScenes,this.stepSelections)).filter(o=>o).map(o=>o.renderableSteps).flat().filter(o=>o.type===Ye.Model||o.type===Ye.Material).forEach(o=>{if(!o.option?.id){console.error(`Failed to read option id from step: ${o.stepName}`);return}const l=this.stepSelections[o.stepName]?.selectedVariants||[];if(l.length===0)return;const u=l[0];if(o.type===Ye.Model){if(!this.modelContainer)throw new an("We should always have a model container when injecting a preview!");const c=u.asset?.fileLink;if(!c){console.error(`Failed to read model url from variant: ${u.id} for step: ${o.stepName}`);return}const f=o.data;this.modelContainer.applyModelVariant(o.stepName,{model:c,contextService:this.getLayoutPreviewService()},f.replaceProductModel||!1)}else{const c=u.material;if(!c){console.error(`Failed to read material from variant: ${u.id} for step: ${o.stepName}`);return}o.data.targetMaterials.forEach(d=>{if(!this.modelContainer)throw new an("We should always have a model container when injecting a preview!");this.modelContainer.applyMaterialVariant(d,o.option.id,c)})}}),await i.getInitializationPromise(),this.renderLayouts()}ejectFromPreviewService(){if(this.modelContainer){if(!this.modelContainer.dispose)throw new Error("This feature is not supported in the current preview service.");this.modelContainer.dispose(),this.modelContainer=void 0}this.previewService=void 0}updateStorage(e,t){const n={...this.storage,[e]:{...this.storage[e],...t}};if(!wf(n,this.storage)){this.storage=n;const i=new zS(this.constructSerializableWorkflow());this.commandContext.apply(i,!0),this.onStepSpecificStorageChange(e),this.onStorageChange()}}constructSerializableWorkflow(){const e=[];return this.allScenes.forEach(t=>{t.renderableSteps.forEach(n=>{const i={stepName:n.stepName};i.storage=this.storage[n.stepName],i.selectedVariants=this.stepSelections[n.stepName]?.selectedVariants?.map(a=>({id:a.id,priceModifier:a.priceModifier})),e.push(i)})}),{steps:e}}updateStateWithServer(){if(this.readOnly)return;const e=this.serialize();this.workflowStatePromiseQueue.enqueue(new _E(async()=>{await new Promise(t=>{setTimeout(()=>{t()},1)}),await this.updateTransaction({variables:{id:this.experience.getTransaction().id,workflowState:e}})}))}async updateStateWithServerImmediate(){if(this.readOnly)return;const e=this.serialize();return new _E(async()=>{await this.updateTransaction({variables:{id:this.experience.getTransaction().id,workflowState:e}})}).execute()}serialize(){const e=this.getCommandContext().getState();if(!e)throw new an("Attempted to serialize state before it was initialized.");const t=Ao(e.transaction),n=sV(t);return JSON.stringify(n,aV,void 0)}async getStateHash(){const e=this.getCommandContext().getState(),n=Object.values(e?.transaction.layouts||{}).map(s=>s.modificationID??"").sort().join(""),a=new TextEncoder().encode(n);if(typeof window<"u"&&window.crypto&&window.crypto.subtle&&window.crypto.subtle.digest){const s=await window.crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array(s)).map(u=>u.toString(16).padStart(2,"0")).join("")}try{return(await import("crypto")).createHash("sha256").update(n,"utf8").digest("hex")}catch{throw new Error("Unable to compute SHA-256 hash: no suitable crypto implementation available.")}}async outstandingRequestsPromise(){return this.workflowStatePromiseQueue.finalize()}updateMetadata(e,t){this.stepMetadata={...this.stepMetadata,[e]:{...this.stepMetadata[e],...t}},this.onMetadataChange()}removeElements(e){const t=(n,i)=>Object.keys(n).reduce((a,s)=>{const o=[...n[s]||[]];return i.forEach(l=>{const u=o.findIndex(c=>c.id===l.id);u>-1&&o.splice(u,1)}),a[s]=o,a},{});this.stepElements=t(this.stepElements,e)}async getInvalidCanvasRegions(){let e=[];for(const t of this.experience.getWorkflow()?.steps||[])if(!await po(t,this.stepSelections)&&this.stepElements[t.stepName])for(const n of this.stepElements[t.stepName])e.push(n);return e}async getInvalidModelVariants(){let e=[];for(const t of this.experience.getWorkflow()?.steps||[])t.type===Ye.Model&&!await po(t,this.stepSelections)&&e.push(t.stepName);return e}async stepElementsForIntroducedSilentSteps(e,t){const n=this.experience.getProduct();if(!n)return Promise.resolve({stepElements:{},commands:[]});const i=async(u,c,f)=>{if(u.type===Ye.SilentIllustration){const d=await new HS(u,c).trigger();return{step:u,results:d}}else if(u.type===Ye.ProductOverlay){const d=await new HS(u,c,f).trigger();return{step:u,results:d}}return Promise.reject("Unknown silent step. This is a bug")},a=e.filter(u=>!this.stepInitialised[u.stepName]),s={stepElements:{},commands:[]},o=[];for(const u of a)this.markStepsAsInitialised([u.stepName]),t||o.push(i(u,this.layouts,n));const l=await Promise.all(o);for(const u of l)s.stepElements[u.step.stepName]=u.results.map(c=>c.regionElement),s.commands=[...s.commands,...u.results.map(c=>c.command)];return s}getStepStorage(e){return this.storage[e]}getMetadata(e){return this.stepMetadata[e]}getWorkflowMetadata(){return this.stepMetadata}getStepTags(e){return this.stepTags[e]||[]}getSerializedStep(e,t){return t.find(n=>n.stepName===e)}async updateTransactionShareActions(){const e=await this.client.getShareActionsForTransaction(this.experience.getTransaction().id);this.experience.getTransaction().transactionShareActions=e}async updateTransactionStakeholders(){const e=await Le.getShadowGraphqlClient().query({query:uM,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.experience.getTransaction().id}});!e?.data?.transactions||e.data.transactions.length!==1?(this.experience.getTransaction().currentStakeholder=void 0,this.experience.getTransaction().stakeholders=void 0):(this.experience.getTransaction().stakeholders=e.data.transactions[0].stakeholders,this.experience.getTransaction().currentStakeholder=e.data.transactions[0].currentStakeholder)}async approveTransaction(e){await Le.getShadowGraphqlClient().mutate({mutation:J9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.experience.getTransaction().id,note:e}})}async rejectTransaction(e){await Le.getShadowGraphqlClient().mutate({mutation:K9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.experience.getTransaction().id,note:e}})}async reset(){this.stepElements={},this.stepInitialised={},this.stepMetadata={},this.stepSelections={},this.storage={},await this.ensureStepsAreLoaded()}async setSelectionsAndElements(e,t,n,i){const a=this.experience.getWorkflow();if(!a)throw new Error("Attempted to set selections when no workflow is set!");const s=this.stepSelections;this.stepSelections={...this.stepSelections,[e]:{selectedVariants:t}};for(const R of a.steps)await po(R,this.stepSelections)||(this.stepInitialised[R.stepName]=!1,delete this.stepMetadata[R.stepName],delete this.stepSelections[R.stepName],delete this.storage[R.stepName]);const o=this.allScenes,l=await Za(o,s),u=await Za(o,this.stepSelections),c=l.map(R=>R.silentSteps).flat(),d=u.map(R=>R.silentSteps).flat().filter(R=>!c.some(O=>O.stepName===R.stepName));for(const R of c)await po(R,this.stepSelections)||(this.stepInitialised[R.stepName]=!1);const h=await this.getInvalidCanvasRegions(),{stepElements:g,commands:y}=await this.stepElementsForIntroducedSilentSteps(d,!1);this.stepElements={...this.stepElements,...g,[e]:n},this.removeElements(h);const v=a.steps.find(R=>R.stepName===e);v?.type===Ye.Frame&&this.getWorkflowExperience().getStepById(v.stepName)?.frameService?.setTargetElements(n.map(O=>O.id));const A=h.map(R=>new Oo(R.id)),x=new zS(this.constructSerializableWorkflow()),S=[...y,...A,x];S.length>0&&this.commandContext.apply(new In(S),!0),await this.ensureStepsAreLoaded(),this.selectionCost=Object.values(this.stepSelections).reduce((R,O)=>R+O.selectedVariants.map(W=>W.priceModifier||0).reduce((W,Y)=>W+Y,0),0),this.onElementsChange();const F=await this.getInvalidModelVariants(),E=this.modelContainer;if(E){const R=F.map(O=>E.applyModelVariant(O,{contextService:this.getLayoutPreviewService()},!1));await Promise.all(R)}await this.onSelectionChange(),await this.reapplyMaterialSteps(),v?.type!==Ye.Frame&&v?.type!==Ye.Text&&this.setMandatoryFulfilled(e,!0),i&&await i()}async ensureStepsAreLoaded(){const t=(await Za(this.allScenes,this.stepSelections)).map(l=>l.renderableSteps),n=[],i=t.flat();console.log("[ensureStepsAreLoaded] All steps:",i);for(const l of i)if(!this.stepInitialised[l.stepName])switch(this.stepInitialised[l.stepName]=!0,l.type){case Ye.DigitalContent:n.push(L1.init(l,this,this.reloadedState));break;case Ye.Frame:n.push(uo.init(l,this,this.reloadedState));break;case Ye.Illustration:n.push(ef.init(l,this,this.reloadedState));break;case Ye.Material:n.push(U1.init(l,this,this.reloadedState));break;case Ye.Model:n.push(V1.init(l,this,this.reloadedState));break;case Ye.Module:this.stepSpecificServices[l.stepName]={module:await DI(l.data.module)},n.push($1.init(l,this,this.reloadedState));break;case Ye.Picture:n.push(z1.init(l,this,this.reloadedState));break;case Ye.Question:n.push(H1.init(l,this,this.reloadedState));break;case Ye.Shape:n.push(Vu.init(l,this,this.reloadedState));break;case Ye.Text:n.push(ri.init(l,this,this.reloadedState));break}const a=(await Promise.allSettled(n)).map(l=>{if(l.status==="rejected")throw new Error(`Step initialization failed: ${l.reason}`);return l.value}),s=a.flatMap(l=>l?.command?[l.command]:[]),o=a.flatMap(l=>l?.followup?[l.followup]:[]);s&&s.length>0&&this.commandContext.apply(new In(s),!0);for(const l of o)await l();o.length>0&&await this.ensureStepsAreLoaded(),this.onInitChange()}onConfirmChange(){this.confirmCallbacks.forEach(e=>e(this.confirmedDesign))}onEditedChange(){this.editedCallbacks.forEach(e=>e(this.editedSteps))}onElementsChange(){this.elementsCallbacks.forEach(e=>e(this.stepElements))}onInformationResultChange(){this.informationResultCallbacks.forEach(e=>e(this.informationResults))}onInitChange(){this.initCallbacks.forEach(e=>e(this.stepInitialised))}onMakingAdjustmentsChange(){this.makingAdjustmentsCallback.forEach(e=>{e(this.currentAdjustingStepId)})}onMandatoryChange(){this.mandatoryCallbacks.forEach(e=>e(this.mandatorySteps))}onMetadataChange(){this.metadataCallbacks.forEach(e=>{e(this.stepMetadata)})}async onSelectionChange(){const e=await this.traversableScenes();for(const t of this.selectionCallbacks)t({selectionCost:this.selectionCost,selections:this.stepSelections,traversableScenes:e})}onStepSpecificStorageChange(e){Object.keys(this.stepSpecificStorageCallbacks).includes(e)||(this.stepSpecificStorageCallbacks[e]=[]),this.stepSpecificStorageCallbacks[e].forEach(t=>t(this.storage[e]))}onStorageChange(){this.storageCallbacks.forEach(e=>e(this.storage))}onValidationChange(){this.validationCallbacks.forEach(e=>e(this.validationErrors))}traversableScenes(){return r5(this.allScenes,this.stepSelections,this.singleVariantsRenderable)}async reapplyMaterialSteps(){if(!this.modelContainer)return;const t=(await Za(this.allScenes,this.stepSelections)).flatMap(n=>n.renderableSteps).filter(n=>n.type===Ye.Material);for(const n of t){const i=this.stepSelections[n.stepName]?.selectedVariants;if(!i||i.length===0)continue;const s=i[0].material;if(!s||!n.option?.id)continue;n.data.targetMaterials.forEach(l=>{this.modelContainer?.applyMaterialVariant(l,n.option.id,s)})}}};lf.configurationPromiseMap=new Map;let wA=lf;class Pa{constructor(e){this.variantData=e}getType(){return this.variantData.asset?.type}getId(){return this.variantData.id}getName(){return this.variantData.name}getPriceFormatted(e,t){return this.variantData.priceModifier.toLocaleString(e||"en-US",{style:"currency",currency:"USD",...t})}getPrice(){return this.variantData.priceModifier}getAsset(){return this.variantData.asset?.fileLink}getAssetResource(){return this.variantData.asset}getThumbnail(e=256,t){const n=this.variantData.thumbnail;if(!(!n||!n.fileLink))return Wg(n,e,"webp",t)}getColor(){return this.variantData.color}isDefault(){return!!this.variantData.default}getResource(){return this.variantData}isEnabled(){return this.variantData.enabled}getCategory(){return this.variantData.category}getProduct(){return this.variantData.product}}const uf=class uf{constructor(e,t,n){this.manager=e,this.step=t,this.tags=n}setUpdateState(e){uf.updateState.set(`${this.step.stepName}-${this.manager.getWorkflowExperience().getTransaction().id}`,e)}getUpdateState(){return!!uf.updateState.get(`${this.step.stepName}-${this.manager.getWorkflowExperience().getTransaction().id}`)}getCurrentVariant(){const n=this.manager.getWorkflowSelections()[this.step.stepName]?.selections[0];if(n)return new Pa(n)}async getAvailableVariants(){return(await this.getAllVariants()).filter(t=>t.isEnabled())||[]}async getAllVariants(){if(!this.step.option?.id)return[];if(this.step.option.variants)return(this.step.option.variants||[]).map(t=>new Pa(t))||[];const e=await ct.getOption(this.step.option?.id);if(!e)throw new Error("Option not found, cannot fetch variants.");return(e.variants||[]).map(t=>new Pa(t))||[]}getId(){return this.step.stepName}getName(){return this.step.stepTitle}getHelpText(){return this.step.helpText}getType(){return this.step.type}getRaw(){return this.step}getTags(){return this.tags}hasTag(e){return this.tags.includes(e)||!1}getMandatory(){return this.step.mandatory||!1}getOverrideGlobalPropertyConfiguration(e){return(this.manager.getStepStorage(this.step.stepName)?.overrideGlobalConfigurations??{})[e.toString()]??!1}setOverrideGlobalPropertyConfiguration(e,t){const n=this.manager.getStepStorage(this.step.stepName)?.overrideGlobalConfigurations??{};this.manager.updateStorage(this.step.stepName,{overrideGlobalConfigurations:{...n,[e.toString()]:t}})}getGlobalPropertyAspects(e){return this.step.globalPropertyAspectConfigurations?.filter(t=>t.globalPropertyConfigurationId===e&&t.aspectName).map(t=>t.aspectName)??[]}executeAnimations(e){const t=this.manager.getPreviewService(),n=this.manager.getModelContainer(),i=this.step.data.modelAnimation,a=this.step.data.lookAtAnimation;t?a&&t.executeCameraAnimation(a):console.warn("No preview service available, cannot execute camera animations."),n?i&&n.executeAnimation(i,e):console.warn("No model container available, cannot execute model animations.")}};uf.updateState=new Map;let $i=uf;class UI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(e){if(!this.getUpdateState()&&this.getCurrentVariant()!==e)return ef.selectVariant(this.step,e.getResource(),this.manager.getRegionElements(this.step.stepName)||[],t=>this.setUpdateState(t),this.manager)}getColors(){const e=this.manager.getRegionElements(this.step.stepName)||[];if(e.length===0)return;const n=Vn(e[0].id,this.manager.getAllLayoutData()).colors,a=this.getCurrentVariant()?.getAssetResource()?.assetConfiguration,s=a?.defaultColorVariants||[];if(s.length!==0){const o={};return s.forEach(l=>{const u=a.channelNumbers.find(c=>c.number===l.channelNumber);if(u){const c=u.id.replace(/\W/g,"");o[l.channelNumber]={browserValue:n[c]?.browserValue||""}}}),o}try{return n}catch(o){console.error(o)}}setColor(e,t,n){const i=new Map,s=this.getCurrentVariant()?.getAssetResource()?.assetConfiguration;return(s?.defaultColorVariants||[]).length!==0?s.channelNumbers.forEach(l=>{if(l.number.toString()===e){const u=l.id.replace(/\W/g,"");n?i.set(u,{browserValue:t,pmsValue:n}):i.set(u,t)}}):n?i.set(e,{browserValue:t,pmsValue:n}):i.set(e,t),ef.changeColors(this.step,this.manager.getRegionElements(this.step.stepName),this.manager,i)}async getColorOption(){return await ct.ensureFullOption(this.step.data.colorOption)}getAvailableColors(){return this.step.data.colorPickerEnabled?ef.availableColors(this.step,this.manager):Promise.resolve([])}isColorPickerEnabled(){return this.step.data.colorPickerEnabled??!1}isPMSPickerEnabled(){return this.step.data.pmsPickerEnabled??!1}isVariantSearchEnabled(){return this.step.data.enableVariantSearch??!1}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class VI extends $i{constructor(e,t,n){super(e,t,n)}selectVariant(e){return U1.selectVariant(this.step,e.getResource(),this.manager,t=>this.setUpdateState(t))}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class $I extends $i{constructor(e,t,n){super(e,t,n)}selectVariant(e){return V1.selectVariant(this.step,e.getResource(),this.manager,t=>this.setUpdateState(t))}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class zI extends $i{constructor(e,t,n){super(e,t,n)}selectVariant(e){return z1.selectVariant(this.step,e.getResource(),this.manager,t=>this.setUpdateState(t))}isVariantSearchEnabled(){return this.step.data.enableVariantSearch??!1}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class HI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(e){if(!e.getId())throw new Error("Unable to select variant with a null ID");await H1.selectVariant(this.step,e.getId(),this.manager)}async getDisplayType(){return this.step.data.displayType?this.step.data.displayType:(await ct.getOptionForStep(this.step))?.displayType}}class GI extends $i{constructor(e,t,n){super(e,t,n)}selectVariant(e){const t=e.getResource();return Vu.selectVariant(this.step,{fill:t.color,stroke:t.color,variant:t},this.manager.getRegionElements(this.step.stepName)||[],this.manager)}setColor(e){return Vu.selectVariant(this.step,e,this.manager.getRegionElements(this.step.stepName)||[],this.manager)}getColors(){return Vu.availableColours(this.step)}setCustomColor(e){return this.getCurrentVariant()?.getColor()!=="#custom"&&console.warn(`setting custom color for step ${this.step.stepName} but color is ${this.getCurrentVariant()?.getColor()}`),Vu.setCustomColor(e,this.step,this.manager)}getCustomColor(){this.getCurrentVariant()?.getColor()!=="#custom"&&console.warn(`setting custom color for step ${this.step.stepName} but color is ${this.getCurrentVariant()?.getColor()}`);const e=this.manager.getStepStorage(this.step.stepName)?.colour;if(!e)throw new Error(`Color not available on step ${this.step.stepName}. Set a default on the workflow to fix this.`);return e}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class jI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(e){await ri.selectVariant(this.step,e.getResource(),this.manager,t=>{if(t)this.manager.setInformationResults([...this.manager.getInformationResults(),{message:t,messageType:eh.Error,stepID:this.step.stepName}]);else{const n=this.manager.getInformationResults().filter(i=>i.stepID!==this.step.stepName);this.manager.setInformationResults(n)}},()=>{})}async getAvailableFillColors(){return this.step.data.colorPickerEnabled?ri.availableFillColors(this.step):[]}async setFillColor(e){const t=this.manager.getRegionElements(this.step.stepName);await ri.changeFillColor(this.step,e,t,this.manager)}getFillColor(){return this.manager.getStepStorage(this.step.stepName)?.color||"#000000"}getAvailableFillImages(){return ri.availableFillImages(this.step)}async setFillImage(e){const t=this.manager.getRegionElements(this.step.stepName);await ri.changeFillImage(this.step,e,t,this.manager)}getFillImage(){return this.manager.getStepStorage(this.step.stepName)?.fillImage}getAlignment(){return ri.findLayoutElements(this.manager,this.step)?.[0].align}setAlignment(e){const t=this.manager.getRegionElements(this.step.stepName);ri.changeAlignment(this.step,e,t,this.manager)}setFullTextCustomization(e){const t=this.manager.getStepStorage(this.step.stepName)?.inputText||"",n=this.step.data.replaceableText!==void 0?this.step.data.replaceableText.replace("{{}}",t):t,i=e?n:this.step.data.defaultText;return this.manager.updateStorage(this.step.stepName,{customiseAllText:e,text:i,defaultCleared:!1}),this.setText(i)}setText(e){const t={input:e,helperData:{}},n=ri.findLayoutElements(this.manager,this.step),i=ri.filterUnsupportedCharacters(e,n[0]?.fontData),a=Wu(i,this.manager).length,s=!!this.step.data&&!!this.step.data.maxLength&&a>this.step.data.maxLength;s||(t.input=i);const o=n.length<=0,l=o?{inputText:i,text:i}:{inputText:i};this.manager.updateStorage(this.step.stepName,l);const u=this.manager.getStepStorage(this.step.stepName),c=ri.getProcessedInput(i,this.step.data,u?.customiseAllText??!1);if(o)s||this.manager.updateMetadata(this.step.stepName,{text:c});else{const{command:f,errorData:d,helperData:h}=ri.updateInputText(i,n,this.step,this.manager);f&&this.manager.getCommandDispatcher()(f),t.helperData=h,t.errorData=d,!s&&!d&&this.manager.updateMetadata(this.step.stepName,{text:c})}return t}getText(){const e=this.step.data.defaultText,t=this.manager.getStepStorage(this.step.stepName);return e&&t?.defaultCleared!==void 0&&!t?.defaultCleared?e:this.manager.getStepStorage(this.step.stepName)?.text||""}isReplaceable(){return this.step.data.userCanReplaceText}newLinesSupported(){return this.step.data.allowNewlines||!1}clearDefaultTextIfNecessary(){if(!this.manager.getStepStorage(this.step.stepName)?.defaultCleared&&this.step.data.deleteDefaultOnFocus){const t=this.setText("");this.manager.updateStorage(this.step.stepName,{defaultCleared:!0,inputText:""});const n=ri.findLayoutElements(this.manager,this.step);return ri.updateInputText("",n,this.step,this.manager),t}}hasColorPicker(){return this.step.data.colorPickerEnabled}getRegions(){return this.step.data.regions}getCharacterLimit(){return this.step.data.maxLength}getCharactersRemaining(){const e=this.step.data.maxLength;if(e===void 0)return;const t=Wu(this.getText(),this.manager);return e-t.length}setCustomColor(e){this.getFillColor()!=="#custom"&&console.warn(`setting custom color for text step ${this.step.stepName} but current fill is not #custom`);const t=this.manager.getRegionElements(this.step.stepName);ri.applyCustomFillColor(this.step,e,t,this.manager)}getCustomColor(){return this.manager.getStepStorage(this.step.stepName)?.customColor||"#000000"}async getAvailableStrokeColors(){return this.step.data.strokeEnabled?ri.availableStrokeColors(this.step):[]}getStrokeColor(){return this.manager.getStepStorage(this.step.stepName)?.strokeColor?.browserValue||"#000000"}async setStrokeColor(e){const t=this.manager.getRegionElements(this.step.stepName);await ri.changeStrokeColor(this.step,e,t,this.manager)}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class qI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(){}getContent(){return this.step.data.content}}class WI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(){}getPreviewURL(){return this.manager.getStepStorage(this.step.stepName)?.videoUrl||""}async selectVideo(e){return L1.regenerateQRCode(this.manager.getRegionElements(this.step.stepName),e.key,this.manager,this.step)}}class QI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(){console.info("Text Modules don't support variants.")}getCharactersRemaining(){const e=this.step.data.maxLength;if(e===void 0)return;const t=Wu(this.getText(),this.manager);return e-t.length}getCharacterLimit(){return this.step.data.maxLength}getText(){return this.manager.getStepStorage(this.step.stepName)?.text||""}setText(e){$1.changeText(this.step,e,this.manager,t=>{if(t){const n=[...this.manager.getInformationResults(),{message:t,messageType:eh.Error,stepID:this.step.stepName}];this.manager.setInformationResults(n)}else{const n=this.manager.getInformationResults().filter(i=>i.stepID!==this.step.stepName);this.manager.setInformationResults(n)}})}}class YI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(){}async getAvailableVariants(){const e=await super.getAvailableVariants();if(!this.cachedProductIds){this.cachedProductIds=new Set;for(const t of e){const n=t.getProduct();n?.id&&this.cachedProductIds.add(n.id)}}return e}isPersonalisable(e){const t=e.getProduct();return!!t?.workflows&&t.workflows.length>0}async addProduct(e){const t=this.manager.getWorkflowExperience().getBundle();if(!t)throw new Error("Product step requires bundle context");const n=e.getProduct();if(!n)throw new Error("Variant has no product. Ensure the option query includes the product field on variants.");if(!this.isPersonalisable(e)){await this.incrementNonPersonalisable(e);return}const i=this.manager.getWorkflowExperience().getTransaction(),a=i.integrationProduct?.integration?.id;let s;if(a&&n.integrationProducts&&(s=n.integrationProducts.find(d=>d.integration?.id===a)?.id),!s)throw new Error("No integration product found for bundle context");const o=this.manager.getClient(),l=n?.workflows||[];let u;if(l.length===1)u=l[0].id;else if(l.length>1){const f=this.step.data.workflows,d=l.find(h=>f.includes(h.id));if(d)u=d.id;else throw new Error("Multiple workflows available but none match step configuration")}const c=await o.getWorkflowExperience({type:"integration",integrationProductId:s,workflowId:u,parentTransactionId:i.id});await t.addWorkflowExperience(c)}async incrementNonPersonalisable(e){const t=this.manager.getWorkflowExperience().getBundle();if(!t)return;const n=e.getProduct(),i=this.findExperienceForProduct(n.id);if(i){const c=i.getTransaction().quantity||1;await i.setQuantity(c+1);return}const a=this.manager.getWorkflowExperience().getTransaction(),s=a.integrationProduct?.integration?.id;let o;if(s&&n.integrationProducts&&(o=n.integrationProducts.find(f=>f.integration?.id===s)?.id),!o)throw new Error("No integration product found for bundle context");const u=await this.manager.getClient().getWorkflowExperience({type:"integration",integrationProductId:o,parentTransactionId:a.id});await t.addWorkflowExperience(u)}async removeProduct(e){const t=this.manager.getWorkflowExperience().getBundle();if(!t)throw new Error("Product step requires bundle context");const i=t.getWorkflowExperiences().find(o=>o.getTransaction().id===e);if(!i)throw new Error("Transaction is not a child of this product step");const a=i.getTransaction(),s=a.quantity||1;if(s>1){await i.setQuantity(s-1);return}await t.removeWorkflowExperienceByTransaction(a)}isCategoryFilterEnabled(){return this.step.data.categoryFilterEnabled??!1}isSearchBarEnabled(){return this.step.data.searchBarEnabled??!1}getMin(){return this.step.data.min}getMax(){return this.step.data.max}getPricing(){return this.step.data.pricing}getWorkflows(){return this.step.data.workflows||[]}getChildTransactions(){const e=this.manager.getWorkflowExperience().getBundle();if(!e)return[];const t=this.manager.getWorkflowExperience().getTransaction().id,n=e.getWorkflowExperiences(),i=this.getStepProductIds();return n.map(a=>a.getTransaction()).filter(a=>a.parentTransaction?.id!==t||i.size===0?!1:a.product?.id?i.has(a.product.id):!1)}getStepProductIds(){if(this.cachedProductIds&&this.cachedProductIds.size>0)return this.cachedProductIds;const e=this.step.option?.variants||[],t=new Set;for(const n of e)n.product?.id&&t.add(n.product.id);return t}getLockedAddOns(){return this.step.data.lockedAddOns||[]}findExperienceForProduct(e){const t=this.manager.getWorkflowExperience().getBundle();if(!t)return;const n=this.manager.getWorkflowExperience().getTransaction().id,i=this.getStepProductIds();return t.getWorkflowExperiences().find(a=>{const s=a.getTransaction();return s.parentTransaction?.id!==n||i.size>0&&!i.has(e)?!1:s.product?.id===e})}}class Fp{static get(e,t){switch(t.type){case Ye.DigitalContent:return new WI(e,t,e.getStepTags(t.stepName));case Ye.Information:return new qI(e,t,e.getStepTags(t.stepName));case Ye.Question:return new HI(e,t,e.getStepTags(t.stepName));case Ye.Text:return new jI(e,t,e.getStepTags(t.stepName));case Ye.Illustration:return new UI(e,t,e.getStepTags(t.stepName));case Ye.Picture:return new zI(e,t,e.getStepTags(t.stepName));case Ye.Shape:return new GI(e,t,e.getStepTags(t.stepName));case Ye.Material:return new VI(e,t,e.getStepTags(t.stepName));case Ye.Model:return new $I(e,t,e.getStepTags(t.stepName));case Ye.Frame:return new mD(e,t,e.getStepTags(t.stepName));case Ye.Module:return new QI(e,t,e.getStepTags(t.stepName));case Ye.Product:return new YI(e,t,e.getStepTags(t.stepName));default:throw new an(`Step type ${t.type} not yet supported in Core SDK`)}}}var _y,LE;function uV(){if(LE)return _y;LE=1;var r=1/0,e=9007199254740991,t=17976931348623157e292,n=NaN,i="[object Function]",a="[object GeneratorFunction]",s="[object Symbol]",o=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,f=/^(?:0|[1-9]\d*)$/,d=parseInt,h=Object.prototype,g=h.toString,y=Math.ceil,v=Math.max;function A(K,le,he){var Me=-1,De=K.length;le<0&&(le=-le>De?0:De+le),he=he>De?De:he,he<0&&(he+=De),De=le>he?0:he-le>>>0,le>>>=0;for(var Pe=Array(De);++Me<De;)Pe[Me]=K[Me+le];return Pe}function x(K,le){return le=le??e,!!le&&(typeof K=="number"||f.test(K))&&K>-1&&K%1==0&&K<le}function S(K,le,he){if(!Y(he))return!1;var Me=typeof le;return(Me=="number"?R(he)&&x(le,he.length):Me=="string"&&le in he)?E(he[le],K):!1}function F(K,le,he){(he?S(K,le,he):le===void 0)?le=1:le=v(z(le),0);var Me=K?K.length:0;if(!Me||le<1)return[];for(var De=0,Pe=0,re=Array(y(Me/le));De<Me;)re[Pe++]=A(K,De,De+=le);return re}function E(K,le){return K===le||K!==K&&le!==le}function R(K){return K!=null&&W(K.length)&&!O(K)}function O(K){var le=Y(K)?g.call(K):"";return le==i||le==a}function W(K){return typeof K=="number"&&K>-1&&K%1==0&&K<=e}function Y(K){var le=typeof K;return!!K&&(le=="object"||le=="function")}function ae(K){return!!K&&typeof K=="object"}function U(K){return typeof K=="symbol"||ae(K)&&g.call(K)==s}function $(K){if(!K)return K===0?K:0;if(K=Q(K),K===r||K===-r){var le=K<0?-1:1;return le*t}return K===K?K:0}function z(K){var le=$(K),he=le%1;return le===le?he?le-he:le:0}function Q(K){if(typeof K=="number")return K;if(U(K))return n;if(Y(K)){var le=typeof K.valueOf=="function"?K.valueOf():K;K=Y(le)?le+"":le}if(typeof K!="string")return K===0?K:+K;K=K.replace(o,"");var he=u.test(K);return he||c.test(K)?d(K.slice(2),he?2:8):l.test(K)?n:+K}return _y=F,_y}var cV=uV();const xA=Us(cV),dV=Ce`
|
|
2665
|
+
`,sV=(r,e)=>e&&typeof e=="object"&&!Array.isArray(e)?Object.keys(e).sort().reduce((t,n)=>(t[n]=e[n],t),{}):e,oV=r=>{for(const e of Object.values(r.layouts).map(t=>t.elements).flat())e.type==="illustration"&&(delete e.cachedObjectURL,e.src&&delete e.svg),e.type==="frame"&&delete e.pattern?.svg;return LI(r,"__typename"),r},LI=(r,e)=>{if(!(typeof r!="object"||r===null))for(const t in r)t===e?delete r[t]:LI(r[t],e)};var eh=(r=>(r.Error="Error",r.Warning="Warning",r.Info="Info",r))(eh||{});const lV=1e3;class _E extends Yg{constructor(e){super(),this.update=e}async execute(){await this.update(),await new Promise(e=>{window.setTimeout(()=>{e()},lV)})}}const uV=r=>r.sort((e,t)=>e.index-t.index).map(e=>({id:Ar(),panelId:e.name,name:e.name,title:e.title,index:e.index,createdAt:new Date,updatedAt:new Date,transparentBackground:e.transparentBackground,height:e.height,width:e.width,previewRegion:e.previewRegion,useEditableArea:e.useEditableArea,editableArea:e.editableArea})),NE=(r,e)=>{const t=r.workflowState,n=t?JSON.parse(t):void 0;return n?Object.values(n.layouts).map(i=>i.layout):uV(e.panels)},lf=class lf{constructor(e,t,n,i,a,s=!1,o,l=!1,u=!1,c=!1){this.workflowStatePromiseQueue=new Xg(1),this.initialized=!1,this.readOnly=!1,this.isReloadedTransaction=!1,this.singleVariantsRenderable=!1,this.stepTags={},this.setWorkflow=async d=>{this.confirmedDesign=!1,this.editedSteps={},this.informationResults=[],this.mandatorySteps={},this.pendingUpdates=[],this.selectionCost=0,this.stepSpecificServices={},this.pollers=[],this.allScenes=[],this.stepElements={},this.stepInitialised={},this.stepMetadata={},this.stepSelections={},this.storage={},this.validationErrors={steps:new Map},this.currentAdjustingStepId="",this.reloadedState?this.layouts=Object.values(this.reloadedState.layouts||{}).map(g=>g.layout):d?this.layouts=NE(this.experience.getTransaction(),d):this.layouts=[],this.commandContext.initialize(this.layouts,this.reloadedState),this.renderableContextService=new m9(this.layouts),this.renderableContextService.setWorkflowManager(this),d.steps.forEach(g=>{this.stepTags[g.stepName]=g.tags??[]});const h=this.previewService;this.ejectFromPreviewService(),this.initializationPromise=this.initializeDefaultWorkflowState(d),this.initializationPromise.then(()=>{this.initialized=!0}),this.initializationPromise.catch(g=>{throw this.initialized=!1,new Error(g)}),this.initializationPromise.finally(()=>this.commandContext.registerStateCallback(()=>{this.updateStateWithServer(),this.debouncedRenderLayouts()})),h&&await this.injectIntoPreviewService(h,!0)},this.renderLayouts=()=>{const d=this.getLayoutPreviewService()?.getAll();if(!d)return;const h=this.getCommandContext().getAllLayouts();for(const[,g]of d)g.render(h)},this.debouncedRenderLayouts=v1(()=>this.renderLayouts(),150),this.experience=e,this.client=t,this.updateTransaction=n,this.graphQlClient=i,this.reloadedState=a,this.readOnly=s,this.singleVariantsRenderable=u,this.commandContext=new gI,this.confirmCallbacks=[],this.editedCallbacks=[],this.elementsCallbacks=[],this.informationResultCallbacks=[],this.initCallbacks=[],this.mandatoryCallbacks=[],this.makingAdjustmentsCallback=[],this.metadataCallbacks=[],this.selectionCallbacks=[],this.stepSpecificStorageCallbacks={},this.storageCallbacks=[],this.validationCallbacks=[],this.recipientCallbacks=[],this.modelContainer=o,this.confirmedDesign=!1,this.editedSteps={},this.informationResults=[],this.mandatorySteps={},this.pendingUpdates=[],this.selectionCost=0,this.stepSpecificServices={},this.pollers=[],this.allScenes=[],this.stepElements={},this.stepInitialised={},this.stepMetadata={},this.stepSelections={},this.storage={},this.validationErrors={steps:new Map},this.currentAdjustingStepId="",this.isReloadedTransaction=l,c&&(this.workflowStatePromiseQueue.enabled=!1);const f=this.experience.getWorkflow();f&&this.setWorkflow(f)}async updateWorkflowConfiguration(e){e.panels&&await this.updatePanels(e.panels),e.steps&&await this.updateSteps(e.steps),this.allScenes=D0(this.getWorkflowExperience().getWorkflow()),await this.ensureStepsAreLoaded(),this.renderLayouts(),await this.onSelectionChange()}async updatePanels(e){const t=this.experience.getWorkflow();let n=[...t.panels];if(e.removed&&(n=n.filter(o=>!e.removed.includes(o.name))),e.changed)for(const o of e.changed){const l=n.findIndex(u=>u.name===o.name);l>=0&&(n[l]=o)}if(e.added)for(const{item:o,index:l}of e.added)n.splice(l,0,o);const i=new Map(this.layouts.map(o=>[o.panelId,o])),a=NE(this.experience.getTransaction(),{...t,panels:n}),s=new Map;for(const o of a){const l=i.get(o.panelId);l?s.set(l.id,{...l,...o,id:l.id}):s.set(o.id,o)}this.layouts=Array.from(s.values()),this.commandContext.updateLayouts(this.layouts),this.renderableContextService&&this.renderableContextService.updateLayouts(this.layouts)}async updateSteps(e){if(e.removed)for(const t of e.removed)this.clearStepState(t);if(e.changed)for(const t of e.changed)this.clearStepState(t.stepName)}clearStepState(e){const t=this.stepElements[e];if(t&&t.length>0){const n=t.map(i=>new Oo(i.id));n.length>0&&this.commandContext.apply(new In(n),!0)}delete this.stepSelections[e],delete this.stepMetadata[e],delete this.storage[e],delete this.stepElements[e],delete this.stepInitialised[e],delete this.stepSpecificServices[e],delete this.mandatorySteps[e],this.validationErrors.steps.delete(e)}getTemplatingContext(){const e=this.experience.getTransaction().recipient,t={recipient:e};return this.recipientConversionConfiguration?.requestedDataItems?.forEach(n=>{const i=n.uniqueIdentifier??n.title??"";n.type===Kd.FirstName?t[i]=e?.firstName:n.type===Kd.LastName?t[i]=e?.lastName:n.type===Kd.Custom&&(n.customFieldIndex===1?t[i]=e?.customField1:n.customFieldIndex===2?t[i]=e?.customField2:n.customFieldIndex===3?t[i]=e?.customField3:n.customFieldIndex===4?t[i]=e?.customField4:n.customFieldIndex===5&&(t[i]=e?.customField5),n.option&&(t[i]=n.option.variants?.find(a=>a.id===t[i])?.name))}),t}async updateRecipient(e,t,n,i,a,s,o,l,u,c,f,d,h,g,y,v,A,x){const S=this.experience.getTransaction();if(S.recipient?.id)this.experience.getTransaction().recipient={id:S.recipient.id,firstName:e??S.recipient.firstName,lastName:t??S.recipient.lastName,address:n??S.recipient.address,suburb:i??S.recipient.suburb,state:a??S.recipient.state,email:s??S.recipient.email,postalCode:o??S.recipient.postalCode,country:l??S.recipient.country,mobile:u??S.recipient.mobile,company:c??S.recipient.company,apartment:f??S.recipient.apartment,customField1:d??S.recipient.customField1,customField2:h??S.recipient.customField2,customField3:g??S.recipient.customField3,customField4:y??S.recipient.customField4,customField5:v??S.recipient.customField5,conversionConfigurationId:A||S.recipient.conversionConfigurationId},this.experience.callEvent(Cg.RecipientChanged),await this.graphQlClient().mutate({mutation:tV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:S.recipient.id,firstName:e||S.recipient.firstName,lastName:t||S.recipient.lastName,address:n||S.recipient.address,suburb:i||S.recipient.suburb,state:a||S.recipient.state,email:s||S.recipient.email,postalCode:o||S.recipient.postalCode,country:l||S.recipient.country,mobile:u||S.recipient.mobile,company:c||S.recipient.company,apartment:f||S.recipient.apartment,customField1:d||S.recipient.customField1,customField2:h||S.recipient.customField2,customField3:g||S.recipient.customField3,customField4:y||S.recipient.customField4,customField5:v||S.recipient.customField5,conversionConfigurationId:A||S.recipient.conversionConfigurationId,prevalidated:x}});else{const F=await this.graphQlClient().mutate({mutation:eV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{firstName:e,lastName:t,address:n,suburb:i,state:a,email:s,postalCode:o,country:l,mobile:u,company:c,apartment:f,customField1:d,customField2:h,customField3:g,customField4:y,customField5:v,conversionConfigurationId:A}});S.recipient={id:F?.data?.recipientCreate?.id,firstName:e,lastName:t,address:n,suburb:i,state:a,email:s,postalCode:o,country:l,mobile:u,company:c,apartment:f,customField1:d,customField2:h,customField3:g,customField4:y,customField5:v,conversionConfigurationId:A},this.experience.callEvent(Cg.RecipientChanged),await this.graphQlClient().mutate({mutation:rV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.experience.getTransaction().id,recipientId:F.data?.recipientCreate?.id},context:{transactionOwnerId:this.experience.getTransaction().transactionOwnerId}})}await this.fetchConversionConfiguration(),this.recipientCallbacks.forEach(F=>F(this.experience.getTransaction().recipient))}async fetchConversionConfiguration(){const e=this.experience.getTransaction().recipient;if(e?.conversionConfigurationId&&!this.recipientConversionConfiguration){const t=lf.configurationPromiseMap.get(e.conversionConfigurationId);if(t)this.recipientConversionConfiguration=await t;else{const i=(async()=>(await this.graphQlClient().query({query:nM,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e.conversionConfigurationId}})).data.conversionConfiguration)();lf.configurationPromiseMap.set(e.conversionConfigurationId,i),this.recipientConversionConfiguration=await i}}}async initializeDefaultWorkflowState(e){const t=()=>{const c=e.finalizeStepConfig;if(!c)return;const f=c.lookAtAnimation,d=c.modelAnimation;f&&this.previewService?.executeCameraAnimation(f),d&&this.modelContainer?.executeAnimation(d)};this.reloadedState&&this.reloadedState.serializableWorkflow.steps.forEach(c=>{this.storage[c.stepName]=c.storage||{}});const n=await this.getInitialOptionIds(this.reloadedState?.serializableWorkflow?.steps.reduce((c,f)=>(f.selectedVariants?.length&&(c[f.stepName]={selectedVariants:f.selectedVariants.map(d=>({id:d.id}))}),c),{})),i=ct.getOptions(Array.from(n)),a=this.fetchConversionConfiguration();await Promise.all([i,a]),this.allScenes=D0(e);const o=(await Za(this.allScenes,this.stepSelections)).map(c=>c.silentSteps).flat(),{stepElements:l,commands:u}=await this.stepElementsForIntroducedSilentSteps(o,!!this.reloadedState);this.commandContext.apply(new In(u),!0),this.stepElements={...this.stepElements,...l},await this.ensureStepsAreLoaded(),this.isReloadedTransaction||this.updateStateWithServer(),this.renderLayouts(),this.reloadedState&&t()}getWorkflowExperience(){return this.experience}getClient(){return this.client}setWorkflowStateSyncEnabled(e){this.workflowStatePromiseQueue.enabled=e}getInitializationPromise(){return this.initializationPromise}isInitialized(){return this.initialized}async getInitialOptionIds(e){const t=new Set,n=this.experience.getWorkflow();if(!n)return t;const i=D0(n),a={...e};let s=-1;for(;;){const u=(await Za(i,a)).flatMap(c=>c.renderableSteps);if(u.length===s)break;s=u.length;for(const c of u){if(a[c.stepName])continue;const f=c.option?.defaultVariant?.id;f&&(a[c.stepName]={selectedVariants:[{id:f}]})}}return(await Za(i,a)).flatMap(l=>l.renderableSteps).forEach(l=>{l.option?.id&&!l.option?.variants&&t.add(l.option.id)}),t}addConfirmCallback(e){e(this.confirmedDesign),this.confirmCallbacks.push(e)}addEditedCallback(e){e(this.editedSteps),this.editedCallbacks.push(e)}addElementsCallback(e){e(this.stepElements),this.elementsCallbacks.push(e)}addInformationResultCallback(e){e(this.informationResults),this.informationResultCallbacks.push(e)}addInitCallback(e){e(this.stepInitialised),this.initCallbacks.push(e)}addMandatoryCallback(e){e(this.mandatorySteps),this.mandatoryCallbacks.push(e)}addMetadataCallback(e){e(this.stepMetadata),this.metadataCallbacks.push(e)}async addSelectionCallback(e){e({selectionCost:this.selectionCost,selections:this.stepSelections,traversableScenes:await this.traversableScenes()}),this.selectionCallbacks.push(e)}addStepSpecificStorageCallback(e,t){Object.keys(this.storage).includes(t)||(this.storage[t]={}),e(this.storage[t]),Object.keys(this.stepSpecificStorageCallbacks).includes(t)||(this.stepSpecificStorageCallbacks[t]=[]),this.stepSpecificStorageCallbacks[t].push(e)}addStorageCallback(e){e(this.storage),this.storageCallbacks.push(e)}addMakingAdjustmentsCallback(e){e(this.currentAdjustingStepId),this.makingAdjustmentsCallback.push(e)}addPoller(e){this.pollers.push(e)}addValidationCallback(e){this.validationCallbacks.push(e),e(this.validationErrors)}addRecipientCallback(e){this.recipientCallbacks.push(e),e(this.experience.getTransaction().recipient)}removeRecipientCallback(e){this.recipientCallbacks=this.recipientCallbacks.filter(t=>t!==e)}getLayouts(){return this.layouts}getAllLayoutData(){return this.commandContext.getAllLayouts().map(e=>e.layoutState)}getLayoutPreviewService(){return this.renderableContextService}getInformationResults(){return this.informationResults}getPreviewService(){return this.previewService}getCommandContext(){return this.commandContext}getRegionElements(e){return this.stepElements[e]||[]}getStepSpecificServices(e){return this.stepSpecificServices[e]}getTransactionCustomer(){return this.ownerCustomer}setTransactionCustomer(e){this.ownerCustomer=e}setTransactionCustomerDetails(e){this.ownerCustomer={...this.ownerCustomer,emailAddress:e.email}}getModelContainer(){return this.modelContainer}setModelContainer(e){(!e||this.previewService&&this.previewService.getAllModels().includes(e))&&(this.modelContainer=e,e&&e.metadata&&e.metadata instanceof Map&&this.modelContainer.metadata.set("workflowManager",this))}getCommandDispatcher(){return e=>this.commandContext.apply(e,!this.initialized)}getWorkflowSelections(){const e={};return this.experience.getWorkflow()?.steps.forEach(t=>{const n=this.stepSelections[t.stepName];n&&n.selectedVariants&&n.selectedVariants.length>0&&(e[t.stepName]={selections:n.selectedVariants})}),e}getStepSelections(){return this.stepSelections}markStepsAsInitialised(e){const t={...this.stepInitialised};e.forEach(n=>{t[n]=!0}),this.stepInitialised=t,this.onInitChange()}getUpdatesPending(){return this.pendingUpdates.length>0}markUpdateCompleted(e){this.pendingUpdates=this.pendingUpdates.filter(t=>t!==e)}markUpdatePending(){const e=Ar();return this.pendingUpdates=[...this.pendingUpdates,e],e}setEditedStatus(e,t){this.editedSteps={...this.editedSteps,[e]:t},this.onEditedChange()}setInformationResults(e){this.informationResults=[...e],this.onInformationResultChange()}setCurrentAdjustingStepId(e){this.currentAdjustingStepId=e,this.onMakingAdjustmentsChange()}setMandatoryFulfilled(e,t){this.mandatorySteps[e]!==t&&(this.mandatorySteps={...this.mandatorySteps,[e]:t},this.onMandatoryChange())}async getMandatoryUnfulfilledSteps(){return(await Za(this.allScenes,this.stepSelections)).flatMap(a=>a.renderableSteps).filter(a=>a.mandatory).filter(a=>!this.mandatorySteps[a.stepName]).map(a=>a.stepName)}setStepError(e,t,n){let i=!1;if(!this.validationErrors.steps.has(e)&&n)i=!0,this.validationErrors.steps.set(e,new Map([[t,n]]));else if(this.validationErrors.steps.has(e)){const a=this.validationErrors.steps.get(e);n&&n!==a.get(t)?(i=!0,a.set(t,n)):n||(i=!0,a.delete(t),a.size===0&&this.validationErrors.steps.delete(e))}i&&this.onValidationChange()}getStepErrors(e){return this.validationErrors.steps.get(e)}getValidationErrors(){return this.validationErrors}toggleDesignConfirmed(){this.confirmedDesign=!this.confirmedDesign,this.onConfirmChange()}toggleMakingAdjustmentsCallback(e){e(this.mandatorySteps),this.mandatoryCallbacks.push(e)}async injectIntoPreviewService(e,t){if(this.modelContainer)throw new Error("You must eject from the preview service before injecting again.");this.previewService=e;const n=this.experience.getProduct();if(!n?.modelUrl||!this.previewService)return;const i=e.loadModel({model:n.modelUrl,contextService:this.getLayoutPreviewService()},{refocusCamera:t});this.setModelContainer(i),(await Za(this.allScenes,this.stepSelections)).filter(o=>o).map(o=>o.renderableSteps).flat().filter(o=>o.type===Ye.Model||o.type===Ye.Material).forEach(o=>{if(!o.option?.id){console.error(`Failed to read option id from step: ${o.stepName}`);return}const l=this.stepSelections[o.stepName]?.selectedVariants||[];if(l.length===0)return;const u=l[0];if(o.type===Ye.Model){if(!this.modelContainer)throw new an("We should always have a model container when injecting a preview!");const c=u.asset?.fileLink;if(!c){console.error(`Failed to read model url from variant: ${u.id} for step: ${o.stepName}`);return}const f=o.data;this.modelContainer.applyModelVariant(o.stepName,{model:c,contextService:this.getLayoutPreviewService()},f.replaceProductModel||!1)}else{const c=u.material;if(!c){console.error(`Failed to read material from variant: ${u.id} for step: ${o.stepName}`);return}o.data.targetMaterials.forEach(d=>{if(!this.modelContainer)throw new an("We should always have a model container when injecting a preview!");this.modelContainer.applyMaterialVariant(d,o.option.id,c)})}}),await i.getInitializationPromise(),this.renderLayouts()}ejectFromPreviewService(){if(this.modelContainer){if(!this.modelContainer.dispose)throw new Error("This feature is not supported in the current preview service.");this.modelContainer.dispose(),this.modelContainer=void 0}this.previewService=void 0}updateStorage(e,t){const n={...this.storage,[e]:{...this.storage[e],...t}};if(!wf(n,this.storage)){this.storage=n;const i=new zS(this.constructSerializableWorkflow());this.commandContext.apply(i,!0),this.onStepSpecificStorageChange(e),this.onStorageChange()}}constructSerializableWorkflow(){const e=[];return this.allScenes.forEach(t=>{t.renderableSteps.forEach(n=>{const i={stepName:n.stepName};i.storage=this.storage[n.stepName],i.selectedVariants=this.stepSelections[n.stepName]?.selectedVariants?.map(a=>({id:a.id,priceModifier:a.priceModifier})),e.push(i)})}),{steps:e}}updateStateWithServer(){if(this.readOnly)return;const e=this.serialize();this.workflowStatePromiseQueue.enqueue(new _E(async()=>{await new Promise(t=>{setTimeout(()=>{t()},1)}),await this.updateTransaction({variables:{id:this.experience.getTransaction().id,workflowState:e}})}))}async updateStateWithServerImmediate(){if(this.readOnly)return;const e=this.serialize();return new _E(async()=>{await this.updateTransaction({variables:{id:this.experience.getTransaction().id,workflowState:e}})}).execute()}serialize(){const e=this.getCommandContext().getState();if(!e)throw new an("Attempted to serialize state before it was initialized.");const t=Ao(e.transaction),n=oV(t);return JSON.stringify(n,sV,void 0)}async getStateHash(){const e=this.getCommandContext().getState(),n=Object.values(e?.transaction.layouts||{}).map(s=>s.modificationID??"").sort().join(""),a=new TextEncoder().encode(n);if(typeof window<"u"&&window.crypto&&window.crypto.subtle&&window.crypto.subtle.digest){const s=await window.crypto.subtle.digest("SHA-256",a);return Array.from(new Uint8Array(s)).map(u=>u.toString(16).padStart(2,"0")).join("")}try{return(await import("crypto")).createHash("sha256").update(n,"utf8").digest("hex")}catch{throw new Error("Unable to compute SHA-256 hash: no suitable crypto implementation available.")}}async outstandingRequestsPromise(){return this.workflowStatePromiseQueue.finalize()}updateMetadata(e,t){this.stepMetadata={...this.stepMetadata,[e]:{...this.stepMetadata[e],...t}},this.onMetadataChange()}removeElements(e){const t=(n,i)=>Object.keys(n).reduce((a,s)=>{const o=[...n[s]||[]];return i.forEach(l=>{const u=o.findIndex(c=>c.id===l.id);u>-1&&o.splice(u,1)}),a[s]=o,a},{});this.stepElements=t(this.stepElements,e)}async getInvalidCanvasRegions(){let e=[];for(const t of this.experience.getWorkflow()?.steps||[])if(!await po(t,this.stepSelections)&&this.stepElements[t.stepName])for(const n of this.stepElements[t.stepName])e.push(n);return e}async getInvalidModelVariants(){let e=[];for(const t of this.experience.getWorkflow()?.steps||[])t.type===Ye.Model&&!await po(t,this.stepSelections)&&e.push(t.stepName);return e}async stepElementsForIntroducedSilentSteps(e,t){const n=this.experience.getProduct();if(!n)return Promise.resolve({stepElements:{},commands:[]});const i=async(u,c,f)=>{if(u.type===Ye.SilentIllustration){const d=await new HS(u,c).trigger();return{step:u,results:d}}else if(u.type===Ye.ProductOverlay){const d=await new HS(u,c,f).trigger();return{step:u,results:d}}return Promise.reject("Unknown silent step. This is a bug")},a=e.filter(u=>!this.stepInitialised[u.stepName]),s={stepElements:{},commands:[]},o=[];for(const u of a)this.markStepsAsInitialised([u.stepName]),t||o.push(i(u,this.layouts,n));const l=await Promise.all(o);for(const u of l)s.stepElements[u.step.stepName]=u.results.map(c=>c.regionElement),s.commands=[...s.commands,...u.results.map(c=>c.command)];return s}getStepStorage(e){return this.storage[e]}getMetadata(e){return this.stepMetadata[e]}getWorkflowMetadata(){return this.stepMetadata}getStepTags(e){return this.stepTags[e]||[]}getSerializedStep(e,t){return t.find(n=>n.stepName===e)}async updateTransactionShareActions(){const e=await this.client.getShareActionsForTransaction(this.experience.getTransaction().id);this.experience.getTransaction().transactionShareActions=e}async updateTransactionStakeholders(){const e=await Le.getShadowGraphqlClient().query({query:uM,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.experience.getTransaction().id}});!e?.data?.transactions||e.data.transactions.length!==1?(this.experience.getTransaction().currentStakeholder=void 0,this.experience.getTransaction().stakeholders=void 0):(this.experience.getTransaction().stakeholders=e.data.transactions[0].stakeholders,this.experience.getTransaction().currentStakeholder=e.data.transactions[0].currentStakeholder)}async approveTransaction(e){await Le.getShadowGraphqlClient().mutate({mutation:K9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.experience.getTransaction().id,note:e}})}async rejectTransaction(e){await Le.getShadowGraphqlClient().mutate({mutation:Z9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.experience.getTransaction().id,note:e}})}async reset(){this.stepElements={},this.stepInitialised={},this.stepMetadata={},this.stepSelections={},this.storage={},await this.ensureStepsAreLoaded()}async setSelectionsAndElements(e,t,n,i){const a=this.experience.getWorkflow();if(!a)throw new Error("Attempted to set selections when no workflow is set!");const s=this.stepSelections;this.stepSelections={...this.stepSelections,[e]:{selectedVariants:t}};for(const R of a.steps)await po(R,this.stepSelections)||(this.stepInitialised[R.stepName]=!1,delete this.stepMetadata[R.stepName],delete this.stepSelections[R.stepName],delete this.storage[R.stepName]);const o=this.allScenes,l=await Za(o,s),u=await Za(o,this.stepSelections),c=l.map(R=>R.silentSteps).flat(),d=u.map(R=>R.silentSteps).flat().filter(R=>!c.some(O=>O.stepName===R.stepName));for(const R of c)await po(R,this.stepSelections)||(this.stepInitialised[R.stepName]=!1);const h=await this.getInvalidCanvasRegions(),{stepElements:g,commands:y}=await this.stepElementsForIntroducedSilentSteps(d,!1);this.stepElements={...this.stepElements,...g,[e]:n},this.removeElements(h);const v=a.steps.find(R=>R.stepName===e);v?.type===Ye.Frame&&this.getWorkflowExperience().getStepById(v.stepName)?.frameService?.setTargetElements(n.map(O=>O.id));const A=h.map(R=>new Oo(R.id)),x=new zS(this.constructSerializableWorkflow()),S=[...y,...A,x];S.length>0&&this.commandContext.apply(new In(S),!0),await this.ensureStepsAreLoaded(),this.selectionCost=Object.values(this.stepSelections).reduce((R,O)=>R+O.selectedVariants.map(W=>W.priceModifier||0).reduce((W,Y)=>W+Y,0),0),this.onElementsChange();const F=await this.getInvalidModelVariants(),E=this.modelContainer;if(E){const R=F.map(O=>E.applyModelVariant(O,{contextService:this.getLayoutPreviewService()},!1));await Promise.all(R)}await this.onSelectionChange(),await this.reapplyMaterialSteps(),v?.type!==Ye.Frame&&v?.type!==Ye.Text&&this.setMandatoryFulfilled(e,!0),i&&await i()}async ensureStepsAreLoaded(){const t=(await Za(this.allScenes,this.stepSelections)).map(l=>l.renderableSteps),n=[],i=t.flat();console.log("[ensureStepsAreLoaded] All steps:",i);for(const l of i)if(!this.stepInitialised[l.stepName])switch(this.stepInitialised[l.stepName]=!0,l.type){case Ye.DigitalContent:n.push(L1.init(l,this,this.reloadedState));break;case Ye.Frame:n.push(uo.init(l,this,this.reloadedState));break;case Ye.Illustration:n.push(ef.init(l,this,this.reloadedState));break;case Ye.Material:n.push(U1.init(l,this,this.reloadedState));break;case Ye.Model:n.push(V1.init(l,this,this.reloadedState));break;case Ye.Module:this.stepSpecificServices[l.stepName]={module:await DI(l.data.module)},n.push($1.init(l,this,this.reloadedState));break;case Ye.Picture:n.push(z1.init(l,this,this.reloadedState));break;case Ye.Question:n.push(H1.init(l,this,this.reloadedState));break;case Ye.Shape:n.push(Vu.init(l,this,this.reloadedState));break;case Ye.Text:n.push(ri.init(l,this,this.reloadedState));break}const a=(await Promise.allSettled(n)).map(l=>{if(l.status==="rejected")throw new Error(`Step initialization failed: ${l.reason}`);return l.value}),s=a.flatMap(l=>l?.command?[l.command]:[]),o=a.flatMap(l=>l?.followup?[l.followup]:[]);s&&s.length>0&&this.commandContext.apply(new In(s),!0);for(const l of o)await l();o.length>0&&await this.ensureStepsAreLoaded(),this.onInitChange()}onConfirmChange(){this.confirmCallbacks.forEach(e=>e(this.confirmedDesign))}onEditedChange(){this.editedCallbacks.forEach(e=>e(this.editedSteps))}onElementsChange(){this.elementsCallbacks.forEach(e=>e(this.stepElements))}onInformationResultChange(){this.informationResultCallbacks.forEach(e=>e(this.informationResults))}onInitChange(){this.initCallbacks.forEach(e=>e(this.stepInitialised))}onMakingAdjustmentsChange(){this.makingAdjustmentsCallback.forEach(e=>{e(this.currentAdjustingStepId)})}onMandatoryChange(){this.mandatoryCallbacks.forEach(e=>e(this.mandatorySteps))}onMetadataChange(){this.metadataCallbacks.forEach(e=>{e(this.stepMetadata)})}async onSelectionChange(){const e=await this.traversableScenes();for(const t of this.selectionCallbacks)t({selectionCost:this.selectionCost,selections:this.stepSelections,traversableScenes:e})}onStepSpecificStorageChange(e){Object.keys(this.stepSpecificStorageCallbacks).includes(e)||(this.stepSpecificStorageCallbacks[e]=[]),this.stepSpecificStorageCallbacks[e].forEach(t=>t(this.storage[e]))}onStorageChange(){this.storageCallbacks.forEach(e=>e(this.storage))}onValidationChange(){this.validationCallbacks.forEach(e=>e(this.validationErrors))}traversableScenes(){return r5(this.allScenes,this.stepSelections,this.singleVariantsRenderable)}async reapplyMaterialSteps(){if(!this.modelContainer)return;const t=(await Za(this.allScenes,this.stepSelections)).flatMap(n=>n.renderableSteps).filter(n=>n.type===Ye.Material);for(const n of t){const i=this.stepSelections[n.stepName]?.selectedVariants;if(!i||i.length===0)continue;const s=i[0].material;if(!s||!n.option?.id)continue;n.data.targetMaterials.forEach(l=>{this.modelContainer?.applyMaterialVariant(l,n.option.id,s)})}}};lf.configurationPromiseMap=new Map;let wA=lf;class Pa{constructor(e){this.variantData=e}getType(){return this.variantData.asset?.type}getId(){return this.variantData.id}getName(){return this.variantData.name}getPriceFormatted(e,t){return this.variantData.priceModifier.toLocaleString(e||"en-US",{style:"currency",currency:"USD",...t})}getPrice(){return this.variantData.priceModifier}getAsset(){return this.variantData.asset?.fileLink}getAssetResource(){return this.variantData.asset}getThumbnail(e=256,t){const n=this.variantData.thumbnail;if(!(!n||!n.fileLink))return Wg(n,e,"webp",t)}getColor(){return this.variantData.color}isDefault(){return!!this.variantData.default}getResource(){return this.variantData}isEnabled(){return this.variantData.enabled}getCategory(){return this.variantData.category}getProduct(){return this.variantData.product}}const uf=class uf{constructor(e,t,n){this.manager=e,this.step=t,this.tags=n}setUpdateState(e){uf.updateState.set(`${this.step.stepName}-${this.manager.getWorkflowExperience().getTransaction().id}`,e)}getUpdateState(){return!!uf.updateState.get(`${this.step.stepName}-${this.manager.getWorkflowExperience().getTransaction().id}`)}getCurrentVariant(){const n=this.manager.getWorkflowSelections()[this.step.stepName]?.selections[0];if(n)return new Pa(n)}async getAvailableVariants(){return(await this.getAllVariants()).filter(t=>t.isEnabled())||[]}async getAllVariants(){if(!this.step.option?.id)return[];if(this.step.option.variants)return(this.step.option.variants||[]).map(t=>new Pa(t))||[];const e=await ct.getOption(this.step.option?.id);if(!e)throw new Error("Option not found, cannot fetch variants.");return(e.variants||[]).map(t=>new Pa(t))||[]}getId(){return this.step.stepName}getName(){return this.step.stepTitle}getHelpText(){return this.step.helpText}getType(){return this.step.type}getRaw(){return this.step}getTags(){return this.tags}hasTag(e){return this.tags.includes(e)||!1}getMandatory(){return this.step.mandatory||!1}getOverrideGlobalPropertyConfiguration(e){return(this.manager.getStepStorage(this.step.stepName)?.overrideGlobalConfigurations??{})[e.toString()]??!1}setOverrideGlobalPropertyConfiguration(e,t){const n=this.manager.getStepStorage(this.step.stepName)?.overrideGlobalConfigurations??{};this.manager.updateStorage(this.step.stepName,{overrideGlobalConfigurations:{...n,[e.toString()]:t}})}getGlobalPropertyAspects(e){return this.step.globalPropertyAspectConfigurations?.filter(t=>t.globalPropertyConfigurationId===e&&t.aspectName).map(t=>t.aspectName)??[]}executeAnimations(e){const t=this.manager.getPreviewService(),n=this.manager.getModelContainer(),i=this.step.data.modelAnimation,a=this.step.data.lookAtAnimation;t?a&&t.executeCameraAnimation(a):console.warn("No preview service available, cannot execute camera animations."),n?i&&n.executeAnimation(i,e):console.warn("No model container available, cannot execute model animations.")}};uf.updateState=new Map;let $i=uf;class UI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(e){if(!this.getUpdateState()&&this.getCurrentVariant()!==e)return ef.selectVariant(this.step,e.getResource(),this.manager.getRegionElements(this.step.stepName)||[],t=>this.setUpdateState(t),this.manager)}getColors(){const e=this.manager.getRegionElements(this.step.stepName)||[];if(e.length===0)return;const n=Vn(e[0].id,this.manager.getAllLayoutData()).colors,a=this.getCurrentVariant()?.getAssetResource()?.assetConfiguration,s=a?.defaultColorVariants||[];if(s.length!==0){const o={};return s.forEach(l=>{const u=a.channelNumbers.find(c=>c.number===l.channelNumber);if(u){const c=u.id.replace(/\W/g,"");o[l.channelNumber]={browserValue:n[c]?.browserValue||""}}}),o}try{return n}catch(o){console.error(o)}}setColor(e,t,n){const i=new Map,s=this.getCurrentVariant()?.getAssetResource()?.assetConfiguration;return(s?.defaultColorVariants||[]).length!==0?s.channelNumbers.forEach(l=>{if(l.number.toString()===e){const u=l.id.replace(/\W/g,"");n?i.set(u,{browserValue:t,pmsValue:n}):i.set(u,t)}}):n?i.set(e,{browserValue:t,pmsValue:n}):i.set(e,t),ef.changeColors(this.step,this.manager.getRegionElements(this.step.stepName),this.manager,i)}async getColorOption(){return await ct.ensureFullOption(this.step.data.colorOption)}getAvailableColors(){return this.step.data.colorPickerEnabled?ef.availableColors(this.step,this.manager):Promise.resolve([])}isColorPickerEnabled(){return this.step.data.colorPickerEnabled??!1}isPMSPickerEnabled(){return this.step.data.pmsPickerEnabled??!1}isVariantSearchEnabled(){return this.step.data.enableVariantSearch??!1}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class VI extends $i{constructor(e,t,n){super(e,t,n)}selectVariant(e){return U1.selectVariant(this.step,e.getResource(),this.manager,t=>this.setUpdateState(t))}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class $I extends $i{constructor(e,t,n){super(e,t,n)}selectVariant(e){return V1.selectVariant(this.step,e.getResource(),this.manager,t=>this.setUpdateState(t))}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class zI extends $i{constructor(e,t,n){super(e,t,n)}selectVariant(e){return z1.selectVariant(this.step,e.getResource(),this.manager,t=>this.setUpdateState(t))}isVariantSearchEnabled(){return this.step.data.enableVariantSearch??!1}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class HI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(e){if(!e.getId())throw new Error("Unable to select variant with a null ID");await H1.selectVariant(this.step,e.getId(),this.manager)}async getDisplayType(){return this.step.data.displayType?this.step.data.displayType:(await ct.getOptionForStep(this.step))?.displayType}}class GI extends $i{constructor(e,t,n){super(e,t,n)}selectVariant(e){const t=e.getResource();return Vu.selectVariant(this.step,{fill:t.color,stroke:t.color,variant:t},this.manager.getRegionElements(this.step.stepName)||[],this.manager)}setColor(e){return Vu.selectVariant(this.step,e,this.manager.getRegionElements(this.step.stepName)||[],this.manager)}getColors(){return Vu.availableColours(this.step)}setCustomColor(e){return this.getCurrentVariant()?.getColor()!=="#custom"&&console.warn(`setting custom color for step ${this.step.stepName} but color is ${this.getCurrentVariant()?.getColor()}`),Vu.setCustomColor(e,this.step,this.manager)}getCustomColor(){this.getCurrentVariant()?.getColor()!=="#custom"&&console.warn(`setting custom color for step ${this.step.stepName} but color is ${this.getCurrentVariant()?.getColor()}`);const e=this.manager.getStepStorage(this.step.stepName)?.colour;if(!e)throw new Error(`Color not available on step ${this.step.stepName}. Set a default on the workflow to fix this.`);return e}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class jI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(e){await ri.selectVariant(this.step,e.getResource(),this.manager,t=>{if(t)this.manager.setInformationResults([...this.manager.getInformationResults(),{message:t,messageType:eh.Error,stepID:this.step.stepName}]);else{const n=this.manager.getInformationResults().filter(i=>i.stepID!==this.step.stepName);this.manager.setInformationResults(n)}},()=>{})}async getAvailableFillColors(){return this.step.data.colorPickerEnabled?ri.availableFillColors(this.step):[]}async setFillColor(e){const t=this.manager.getRegionElements(this.step.stepName);await ri.changeFillColor(this.step,e,t,this.manager)}getFillColor(){return this.manager.getStepStorage(this.step.stepName)?.color||"#000000"}getAvailableFillImages(){return ri.availableFillImages(this.step)}async setFillImage(e){const t=this.manager.getRegionElements(this.step.stepName);await ri.changeFillImage(this.step,e,t,this.manager)}getFillImage(){return this.manager.getStepStorage(this.step.stepName)?.fillImage}getAlignment(){return ri.findLayoutElements(this.manager,this.step)?.[0].align}setAlignment(e){const t=this.manager.getRegionElements(this.step.stepName);ri.changeAlignment(this.step,e,t,this.manager)}setFullTextCustomization(e){const t=this.manager.getStepStorage(this.step.stepName)?.inputText||"",n=this.step.data.replaceableText!==void 0?this.step.data.replaceableText.replace("{{}}",t):t,i=e?n:this.step.data.defaultText;return this.manager.updateStorage(this.step.stepName,{customiseAllText:e,text:i,defaultCleared:!1}),this.setText(i)}setText(e){const t={input:e,helperData:{}},n=ri.findLayoutElements(this.manager,this.step),i=ri.filterUnsupportedCharacters(e,n[0]?.fontData),a=Wu(i,this.manager).length,s=!!this.step.data&&!!this.step.data.maxLength&&a>this.step.data.maxLength;s||(t.input=i);const o=n.length<=0,l=o?{inputText:i,text:i}:{inputText:i};this.manager.updateStorage(this.step.stepName,l);const u=this.manager.getStepStorage(this.step.stepName),c=ri.getProcessedInput(i,this.step.data,u?.customiseAllText??!1);if(o)s||this.manager.updateMetadata(this.step.stepName,{text:c});else{const{command:f,errorData:d,helperData:h}=ri.updateInputText(i,n,this.step,this.manager);f&&this.manager.getCommandDispatcher()(f),t.helperData=h,t.errorData=d,!s&&!d&&this.manager.updateMetadata(this.step.stepName,{text:c})}return t}getText(){const e=this.step.data.defaultText,t=this.manager.getStepStorage(this.step.stepName);return e&&t?.defaultCleared!==void 0&&!t?.defaultCleared?e:this.manager.getStepStorage(this.step.stepName)?.text||""}isReplaceable(){return this.step.data.userCanReplaceText}newLinesSupported(){return this.step.data.allowNewlines||!1}clearDefaultTextIfNecessary(){if(!this.manager.getStepStorage(this.step.stepName)?.defaultCleared&&this.step.data.deleteDefaultOnFocus){const t=this.setText("");this.manager.updateStorage(this.step.stepName,{defaultCleared:!0,inputText:""});const n=ri.findLayoutElements(this.manager,this.step);return ri.updateInputText("",n,this.step,this.manager),t}}hasColorPicker(){return this.step.data.colorPickerEnabled}getRegions(){return this.step.data.regions}getCharacterLimit(){return this.step.data.maxLength}getCharactersRemaining(){const e=this.step.data.maxLength;if(e===void 0)return;const t=Wu(this.getText(),this.manager);return e-t.length}setCustomColor(e){this.getFillColor()!=="#custom"&&console.warn(`setting custom color for text step ${this.step.stepName} but current fill is not #custom`);const t=this.manager.getRegionElements(this.step.stepName);ri.applyCustomFillColor(this.step,e,t,this.manager)}getCustomColor(){return this.manager.getStepStorage(this.step.stepName)?.customColor||"#000000"}async getAvailableStrokeColors(){return this.step.data.strokeEnabled?ri.availableStrokeColors(this.step):[]}getStrokeColor(){return this.manager.getStepStorage(this.step.stepName)?.strokeColor?.browserValue||"#000000"}async setStrokeColor(e){const t=this.manager.getRegionElements(this.step.stepName);await ri.changeStrokeColor(this.step,e,t,this.manager)}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}class qI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(){}getContent(){return this.step.data.content}}class WI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(){}getPreviewURL(){return this.manager.getStepStorage(this.step.stepName)?.videoUrl||""}async selectVideo(e){return L1.regenerateQRCode(this.manager.getRegionElements(this.step.stepName),e.key,this.manager,this.step)}}class QI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(){console.info("Text Modules don't support variants.")}getCharactersRemaining(){const e=this.step.data.maxLength;if(e===void 0)return;const t=Wu(this.getText(),this.manager);return e-t.length}getCharacterLimit(){return this.step.data.maxLength}getText(){return this.manager.getStepStorage(this.step.stepName)?.text||""}setText(e){$1.changeText(this.step,e,this.manager,t=>{if(t){const n=[...this.manager.getInformationResults(),{message:t,messageType:eh.Error,stepID:this.step.stepName}];this.manager.setInformationResults(n)}else{const n=this.manager.getInformationResults().filter(i=>i.stepID!==this.step.stepName);this.manager.setInformationResults(n)}})}}class YI extends $i{constructor(e,t,n){super(e,t,n)}async selectVariant(){}async getAvailableVariants(){const e=await super.getAvailableVariants();if(!this.cachedProductIds){this.cachedProductIds=new Set;for(const t of e){const n=t.getProduct();n?.id&&this.cachedProductIds.add(n.id)}}return e}isPersonalisable(e){const t=e.getProduct();return!!t?.workflows&&t.workflows.length>0}async addProduct(e){const t=this.manager.getWorkflowExperience().getBundle();if(!t)throw new Error("Product step requires bundle context");const n=e.getProduct();if(!n)throw new Error("Variant has no product. Ensure the option query includes the product field on variants.");if(!this.isPersonalisable(e)){await this.incrementNonPersonalisable(e);return}const i=this.manager.getWorkflowExperience().getTransaction(),a=i.integrationProduct?.integration?.id;let s;if(a&&n.integrationProducts&&(s=n.integrationProducts.find(d=>d.integration?.id===a)?.id),!s)throw new Error("No integration product found for bundle context");const o=this.manager.getClient(),l=n?.workflows||[];let u;if(l.length===1)u=l[0].id;else if(l.length>1){const f=this.step.data.workflows,d=l.find(h=>f.includes(h.id));if(d)u=d.id;else throw new Error("Multiple workflows available but none match step configuration")}const c=await o.getWorkflowExperience({type:"integration",integrationProductId:s,workflowId:u,parentTransactionId:i.id});await t.addWorkflowExperience(c)}async incrementNonPersonalisable(e){const t=this.manager.getWorkflowExperience().getBundle();if(!t)return;const n=e.getProduct(),i=this.findExperienceForProduct(n.id);if(i){const c=i.getTransaction().quantity||1;await i.setQuantity(c+1);return}const a=this.manager.getWorkflowExperience().getTransaction(),s=a.integrationProduct?.integration?.id;let o;if(s&&n.integrationProducts&&(o=n.integrationProducts.find(f=>f.integration?.id===s)?.id),!o)throw new Error("No integration product found for bundle context");const u=await this.manager.getClient().getWorkflowExperience({type:"integration",integrationProductId:o,parentTransactionId:a.id});await t.addWorkflowExperience(u)}async removeProduct(e){const t=this.manager.getWorkflowExperience().getBundle();if(!t)throw new Error("Product step requires bundle context");const i=t.getWorkflowExperiences().find(o=>o.getTransaction().id===e);if(!i)throw new Error("Transaction is not a child of this product step");const a=i.getTransaction(),s=a.quantity||1;if(s>1){await i.setQuantity(s-1);return}await t.removeWorkflowExperienceByTransaction(a)}isCategoryFilterEnabled(){return this.step.data.categoryFilterEnabled??!1}isSearchBarEnabled(){return this.step.data.searchBarEnabled??!1}getMin(){return this.step.data.min}getMax(){return this.step.data.max}getPricing(){return this.step.data.pricing}getWorkflows(){return this.step.data.workflows||[]}getChildTransactions(){const e=this.manager.getWorkflowExperience().getBundle();if(!e)return[];const t=this.manager.getWorkflowExperience().getTransaction().id,n=e.getWorkflowExperiences(),i=this.getStepProductIds();return n.map(a=>a.getTransaction()).filter(a=>a.parentTransaction?.id!==t||i.size===0?!1:a.product?.id?i.has(a.product.id):!1)}getStepProductIds(){if(this.cachedProductIds&&this.cachedProductIds.size>0)return this.cachedProductIds;const e=this.step.option?.variants||[],t=new Set;for(const n of e)n.product?.id&&t.add(n.product.id);return t}getLockedAddOns(){return this.step.data.lockedAddOns||[]}findExperienceForProduct(e){const t=this.manager.getWorkflowExperience().getBundle();if(!t)return;const n=this.manager.getWorkflowExperience().getTransaction().id,i=this.getStepProductIds();return t.getWorkflowExperiences().find(a=>{const s=a.getTransaction();return s.parentTransaction?.id!==n||i.size>0&&!i.has(e)?!1:s.product?.id===e})}}class Fp{static get(e,t){switch(t.type){case Ye.DigitalContent:return new WI(e,t,e.getStepTags(t.stepName));case Ye.Information:return new qI(e,t,e.getStepTags(t.stepName));case Ye.Question:return new HI(e,t,e.getStepTags(t.stepName));case Ye.Text:return new jI(e,t,e.getStepTags(t.stepName));case Ye.Illustration:return new UI(e,t,e.getStepTags(t.stepName));case Ye.Picture:return new zI(e,t,e.getStepTags(t.stepName));case Ye.Shape:return new GI(e,t,e.getStepTags(t.stepName));case Ye.Material:return new VI(e,t,e.getStepTags(t.stepName));case Ye.Model:return new $I(e,t,e.getStepTags(t.stepName));case Ye.Frame:return new mD(e,t,e.getStepTags(t.stepName));case Ye.Module:return new QI(e,t,e.getStepTags(t.stepName));case Ye.Product:return new YI(e,t,e.getStepTags(t.stepName));default:throw new an(`Step type ${t.type} not yet supported in Core SDK`)}}}var _y,LE;function cV(){if(LE)return _y;LE=1;var r=1/0,e=9007199254740991,t=17976931348623157e292,n=NaN,i="[object Function]",a="[object GeneratorFunction]",s="[object Symbol]",o=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,f=/^(?:0|[1-9]\d*)$/,d=parseInt,h=Object.prototype,g=h.toString,y=Math.ceil,v=Math.max;function A(K,le,he){var Me=-1,De=K.length;le<0&&(le=-le>De?0:De+le),he=he>De?De:he,he<0&&(he+=De),De=le>he?0:he-le>>>0,le>>>=0;for(var Pe=Array(De);++Me<De;)Pe[Me]=K[Me+le];return Pe}function x(K,le){return le=le??e,!!le&&(typeof K=="number"||f.test(K))&&K>-1&&K%1==0&&K<le}function S(K,le,he){if(!Y(he))return!1;var Me=typeof le;return(Me=="number"?R(he)&&x(le,he.length):Me=="string"&&le in he)?E(he[le],K):!1}function F(K,le,he){(he?S(K,le,he):le===void 0)?le=1:le=v(z(le),0);var Me=K?K.length:0;if(!Me||le<1)return[];for(var De=0,Pe=0,re=Array(y(Me/le));De<Me;)re[Pe++]=A(K,De,De+=le);return re}function E(K,le){return K===le||K!==K&&le!==le}function R(K){return K!=null&&W(K.length)&&!O(K)}function O(K){var le=Y(K)?g.call(K):"";return le==i||le==a}function W(K){return typeof K=="number"&&K>-1&&K%1==0&&K<=e}function Y(K){var le=typeof K;return!!K&&(le=="object"||le=="function")}function ae(K){return!!K&&typeof K=="object"}function U(K){return typeof K=="symbol"||ae(K)&&g.call(K)==s}function $(K){if(!K)return K===0?K:0;if(K=Q(K),K===r||K===-r){var le=K<0?-1:1;return le*t}return K===K?K:0}function z(K){var le=$(K),he=le%1;return le===le?he?le-he:le:0}function Q(K){if(typeof K=="number")return K;if(U(K))return n;if(Y(K)){var le=typeof K.valueOf=="function"?K.valueOf():K;K=Y(le)?le+"":le}if(typeof K!="string")return K===0?K:+K;K=K.replace(o,"");var he=u.test(K);return he||c.test(K)?d(K.slice(2),he?2:8):l.test(K)?n:+K}return _y=F,_y}var dV=cV();const xA=Us(dV),fV=Ce`
|
|
2663
2666
|
fragment CreateDesignTransaction on Transaction {
|
|
2664
2667
|
id
|
|
2665
2668
|
designName
|
|
@@ -2684,8 +2687,8 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2684
2687
|
externalProductVariantId
|
|
2685
2688
|
}
|
|
2686
2689
|
}
|
|
2687
|
-
`,
|
|
2688
|
-
${
|
|
2690
|
+
`,hV=Ce`
|
|
2691
|
+
${fV}
|
|
2689
2692
|
mutation CreateDesigns($inputs: [DesignCreateInput]!) {
|
|
2690
2693
|
designCreateMany(inputs: $inputs) {
|
|
2691
2694
|
id
|
|
@@ -2698,7 +2701,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2698
2701
|
}
|
|
2699
2702
|
}
|
|
2700
2703
|
}
|
|
2701
|
-
`;function xg(r){const e=JSON.parse(atob(r.split(".")[1])).exp;return Math.floor(new Date().getTime()/1e3)>=e}const
|
|
2704
|
+
`;function xg(r){const e=JSON.parse(atob(r.split(".")[1])).exp;return Math.floor(new Date().getTime()/1e3)>=e}const pV=async(r,e)=>{const t={};try{if(e){const i=await e.loggedInBearerToken();t.Authorization=`Bearer ${i}`}else throw new Error}catch{const s=Object.entries(localStorage).find(([l,u])=>l.startsWith("CognitoIdentityServiceProvider")&&l.endsWith("idToken"))?.[0]||"",o=localStorage.getItem(s);o&&!xg(o)&&(t.Authorization=`Bearer ${o}`)}return await e.getBetaEnabled()&&(t["X-Spiff-Beta"]="true"),(await Le.getShadowGraphqlClient().mutate({mutation:hV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{inputs:r.map(i=>({name:i.name,layouts:i.layouts,workflowId:i.workflowId,transactionId:i.transactionId,previewImage:i.previewImage,useThreeDimPreview:i.useThreeDimPreview,metadata:i.metadata,selectedVariants:i.selectedVariants}))},context:{headers:t}})).data?.designCreateMany},UE=(r,e,t)=>{const n=a=>{const s={};if(a.type==="Frame"){const o=r[a.stepName],l=a.data;if(!o||!o.image||l.hideImageInCart&&t)return s;s[`${a.stepTitle} image`]=o.image}if(a.type==="Illustration"){const o=r[a.stepName],l=a.data;if(!o||l.hideColorsInCart&&t||!o.colors)return s;if(o.colors.length>0){const u=o.colors.join(", ").toUpperCase();s[`${a.stepTitle} colors`]=u}}if(a.type==="Module"){const o=r[a.stepName],l=a.data;if(!o||o.text===void 0||o.text===null||l.hideTextInCart&&t)return s;s[`${a.stepTitle} text`]=o.text}if(a.type==="Text"){const o=r[a.stepName];if(!o)return s;const l=a.data;(!l.hideTextInCart||!t&&o.text!==void 0&&o.text!==null)&&(s[`${a.stepTitle} text`]=o.text),o.color&&(!l.hideColorInCart||!t)&&(s[`${a.stepTitle} color`]=o.color),o.strokeColor&&(!l.hideStrokeInCart||!t)&&(s[`${a.stepTitle} stroke`]=o.strokeColor)}return s},i={};return e.steps.forEach(a=>{Object.assign(i,n(a))}),i},gV=(r,e,t,n)=>{const i={};let a={};n&&(a=n);const o=e.steps.map(l=>l.stepTitle).filter((l,u,c)=>c.indexOf(l)==u);for(const l of o){if(Object.keys(r).includes(l)){const u=r[l],c=e.steps.find(f=>f.stepTitle===l);i[`${c?.stepTitle} selection`]={value:u[0].name,priceModifier:u[0].priceModifier}}for(const u of Object.keys(a))[`${l} color`,`${l} colors`,`${l} text`,`${l} image`].includes(u)&&(i[u]={value:a[u],priceModifier:0})}return i},mV=(r,e,t,n,i,a,s,o)=>{const l=e.basePrice||0,u=r.priceModifierTotal||0,c=gV(n,t,void 0,a),d=(wr.getMap("transactionOwnerIds")||new Map).get(r.id),h={additionalExternalProductId:r.integrationProduct?.additionalExternalProductId,additionalExternalVariantId:r.integrationProduct?.additionalExternalVariantId,baseCost:l,designExternalVariants:r.designExternalVariants,designProductId:r.externalDesignProductId,designProductVariantId:r.externalDesignProductVariantId,event:"onComplete",exportedData:c,externalCartProductId:r.externalCartProductId,externalCartProductVariantId:r.externalCartProductVariantId,lineItemImageUrl:s||"",optionsCost:u,processExecutionId:o,quantity:r.quantity,transactionId:r.id,transactionOwnerId:d,weight:e.weight,workflowViewerLink:r.workflowViewerLink||"",workflowViewerReadOnlyLink:r.workflowViewerReadOnlyLink||""};return a&&(h.metadata=a),n&&(h.selectedVariants=n),i&&(h.sku=i),h},yV=r=>{const e=r.integrationProductId||r.integrationProduct?.id,t=r.integrationProduct;if(t?.externalProductId&&t?.externalVariantId)return t;if(e&&r.product?.integrationProducts){const n=r.product.integrationProducts.find(i=>i.id===e);if(n)return{...t,...n}}return t},XI=r=>{const e=yV(r);return{id:r.id,externalProductId:r.externalCartProductId||r.externalDesignProductId||e?.externalProductId||e?.additionalExternalProductId,externalProductVariantId:r.externalCartProductVariantId||r.externalDesignProductVariantId||e?.externalVariantId||e?.additionalExternalVariantId}},vV=async r=>{const e=[...new Set(r.filter(i=>{const a=XI(i);return!a.externalProductId||!a.externalProductVariantId}).map(i=>i.integrationProductId||i.integrationProduct?.id).filter(i=>!!i))];if(e.length===0)return;const t=await oD(e),n=new Map(t.map(i=>[i.id,i]));for(const i of r){const a=i.integrationProductId||i.integrationProduct?.id;if(!a)continue;const s=n.get(a);s&&(i.integrationProduct={...i.integrationProduct,...s},s.product&&(i.product={...i.product,...s.product}))}},AV=(r,e)=>{for(const t of e){const n=t.parentTransaction?.id;if(!n)continue;const i=r.get(n);if(!i)throw new Error(`SpiffCommerce - Unable to attach product-step extra to parent - parent message not found: ${n}`);const a=t.quantity||1,s=XI(t);if(!s.externalProductId||!s.externalProductVariantId)throw new Error(`SpiffCommerce - Product-step extra is missing external product identifiers (transaction: ${t.id})`);const o=i.designExternalVariants||[];i.designExternalVariants=[...o,...Array.from({length:a},()=>({...s}))]}},bV=async(r,e,t,n,i,a,s,o,l,u)=>{u&&(console.warn("State mismatch detected. Uploading known state explicitly"),console.warn("State Object:",JSON.stringify(n())),await r.updateStateWithServerImmediate(n),console.log("Server state is undefined @ Workflow completion"));const c=r.getPreviewService(),f=e?.finalizeStepConfig?.lookAtAnimation,d=c&&e.showModelOnFinishStep&&!!f,h=l&&UE(l,e,!0),g=l&&UE(l,e,!1),y=async R=>{const O={};let W=0;if(Object.keys(a).length>0)for(const Y of Object.keys(a)){const ae=a[Y],U=e.steps.find($=>$.stepName===Y);for(let $=0;$<ae.selections.length;++$){const z=ae.selections[$];if(U){const Q=await ct.getOptionForStep(U);if(!R||Q&&(Q.variants||[]).length>1&&!U.data.hideSelectionInCart&&!U.data.hideSelectionsInCart){const K=U.stepTitle;O[K]?O[K].push({id:z.id||"",name:z.name,priceModifier:z.priceModifier}):O[K]=[{id:z.id||"",name:z.name,priceModifier:z.priceModifier}]}}W+=z.priceModifier}}return[O,W]},[v]=await y(!0),A=Object.fromEntries(Object.keys(v).map(R=>[R,v[R].map(O=>O.id)])),[x]=await y(!1),S=Object.fromEntries(Object.keys(x).map(R=>[R,x[R].map(O=>O.id)]));let F=await o(d,i.id);if(F){const R=await(await Vs(F)).blob();F=(await Un.uploadAsset({name:`${i.id}-preview-image.png`,blob:R},gf.Image,!0,!1)).fileLink}return{designDetails:(()=>{const R={name:s,layouts:t.map(O=>({index:O.index,panelId:O.panelId})),workflowId:e.id,transactionId:i.id,useThreeDimPreview:!!d,previewImage:F};if(g){const O=[];for(const[W,Y]of Object.entries(g))O.push({key:W,value:Y});R.metadata=O}if(A){const O=[];for(const[W,Y]of Object.entries(S))O.push({key:W,ids:Y});R.selectedVariants=O}return R})(),cartSelectionsWithPrices:v,cartMetadata:h}},JI=async(r,e)=>{await Promise.all(r.map(async o=>{await o.workflowManager.outstandingRequestsPromise()}));const n=await(async()=>{const o=Le.getShadowGraphqlClient(),l=await Promise.all(r.map(async d=>({id:d.transaction.id,hash:await d.workflowManager.getStateHash()}))),c=xA(l,100),f=[];for(const d of c){const h=await o.query({query:sM,variables:{transactions:d},fetchPolicy:"no-cache",errorPolicy:"all"});if(h.errors&&h.errors.length>0)return l.map(g=>g.id);f.push(...h.data?.transactionConfirmWorkflowStates??[])}return f})(),i=await Promise.all(r.map(async o=>await bV(o.workflowManager,o.workflow,o.layouts,o.getReducerState,o.transaction,o.workflowSelections,o.designName,e??(()=>Promise.resolve(void 0)),o.workflowMetadata,n.includes(o.transaction.id)))),a=r[0].workflowManager.getClient(),s=await pV(i.map(o=>o.designDetails),a);if(!s)throw new Error("Failed to create designs");return s.map((o,l)=>{const u=r[l],c=i[l],f=o.transaction;return mV(f,u.product,u.workflow,c.cartSelectionsWithPrices,o.sku,c.cartMetadata,f.previewImageLink,o.processExecution?.id)})};class wV{constructor(){this.localPersistenceKey="designTransactions",this.storageMethod="Local",this.designSavedListeners=[]}attachSaveListener(e){this.designSavedListeners.push(e)}detachSaveListener(e){this.designSavedListeners=this.designSavedListeners.filter(t=>t!==e)}async getSavedDesigns(){if(this.storageMethod==="Local"){const e=wr.get(this.localPersistenceKey);return e?JSON.parse(e):[]}throw new an("Unexpected storage method requested")}async getSavedDesignByTransaction(e){return(await this.getSavedDesigns()).find(n=>n.transactionId===e)}async addDesign(e){const n=(await this.getSavedDesigns()).filter(i=>i.transactionId!==e.transactionId);n.unshift(e),await this.setDesigns(n),this.designSavedListeners.forEach(i=>i(e))}async renameDesign(e,t){const n=await this.getSavedDesigns(),i=n.find(a=>a.transactionId===e);if(!i)throw new Error(`No saved design for transaction ${e}.`);i.title=t,await this.setDesigns(n)}async removeDesign(e){const t=await this.getSavedDesigns();await this.setDesigns(t.filter(n=>n.transactionId!==e))}async setDesigns(e){if(this.storageMethod==="Local"){wr.set(this.localPersistenceKey,JSON.stringify(e));return}throw new an("Unexpected storage method requested")}}const eg=new wV,xV=Ce`
|
|
2702
2705
|
mutation AddTransactionStakeholder($id: String!, $type: String!, $details: CustomerDetailsInput!) {
|
|
2703
2706
|
transactionAddStakeholder(id: $id, details: $details, type: $type) {
|
|
2704
2707
|
id
|
|
@@ -2712,7 +2715,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2712
2715
|
}
|
|
2713
2716
|
}
|
|
2714
2717
|
}
|
|
2715
|
-
`,
|
|
2718
|
+
`,CV=Ce`
|
|
2716
2719
|
mutation AddStakeholderToAllTransactions($ids: [String!]!, $type: String!, $details: CustomerDetailsInput!) {
|
|
2717
2720
|
transactionsAddStakeholder(ids: $ids, details: $details, type: $type) {
|
|
2718
2721
|
id
|
|
@@ -2726,7 +2729,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2726
2729
|
}
|
|
2727
2730
|
}
|
|
2728
2731
|
}
|
|
2729
|
-
`,
|
|
2732
|
+
`,SV=Ce`
|
|
2730
2733
|
mutation AddAddressToTransaction(
|
|
2731
2734
|
$transactionId: String!
|
|
2732
2735
|
$streetAddress: String
|
|
@@ -2748,7 +2751,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2748
2751
|
id
|
|
2749
2752
|
}
|
|
2750
2753
|
}
|
|
2751
|
-
`,
|
|
2754
|
+
`,EV=Ce`
|
|
2752
2755
|
mutation AddOrganizationToTransaction($transactionId: String!, $organizationName: String!) {
|
|
2753
2756
|
organizationAttachToTransaction(transactionId: $transactionId, organizationName: $organizationName) {
|
|
2754
2757
|
id
|
|
@@ -2838,7 +2841,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2838
2841
|
}
|
|
2839
2842
|
}
|
|
2840
2843
|
}
|
|
2841
|
-
`;var Cg=(r=>(r.PriceBreakChanged="PriceBreakChanged",r.ProductChanged="ProductChanged",r.QuantityChanged="QuantityChanged",r.RecipientChanged="RecipientChanged",r.SelectionChanged="SelectionChanged",r.WorkflowConfigurationChanged="WorkflowConfigurationChanged",r))(Cg||{});class q1{constructor(e,t){this.cachedStepHandles=new Map,this.profanityList=[],this.currentPriceBreak=1,this.renderableScenes=[],this.renderableSceneCallbacks=[],this.eventCallbacks=new Map,this.debouncedSavedDesignUpdate=v1(async()=>{await eg.getSavedDesignByTransaction(this.getTransaction().id)&&this.save()},2500),this.getCanvasObjectURLAsync=async n=>new Promise((i,a)=>{try{n.toBlob(s=>{if(s){const o=URL.createObjectURL(s);i(o)}})}catch(s){a(s)}}),this.client=e,this.transaction=t.transaction,this.workflow=t.workflow,this.profanityList=this.transaction.product?.profanities?.map(n=>n.word)||[],this.isReadOnly=t.transaction.isOrdered||!!t.readOnly,this.graphQlClient=t.graphQlClient,this.workflowManager=new wA(this,e,n=>{try{this.debouncedSavedDesignUpdate()}catch{console.error("Failed to update saved design details.")}return t.stateMutationFunc(n)},t.graphQlClient,t.reloadedState,t.readOnly,t.modelContainer,t.isReloadedTransaction,t.singleVariantsRenderable,t.delayWorkflowStateSync),this.workflowManager.addSelectionCallback(n=>{const i=n.traversableScenes.map(a=>{const s=a.renderableSteps.map(o=>o.stepName);return{id:a.name,title:a.title,renderableSteps:s,workflowScene:a}});this.renderableScenes=i,this.renderableSceneCallbacks.forEach(a=>a(i)),this.callEvent("SelectionChanged")}),this.currentPriceBreak=this.priceBreakToBeApplied()}getTransaction(){return this.transaction}getProduct(){return this.transaction.product}getProfanityList(){return this.profanityList}async setProduct(e){this.workflow=void 0;const t=await this.graphQlClient().mutate({mutation:VE,variables:{id:this.getTransaction().id,integrationProductId:e}}),n=t.data?.transactionUpdateIntegrationProduct.product;if(!n)throw new an("Failed to set product. No product returned from server.");if(!this.bundle)throw new an("Cannot set product on experience that is not part of a bundle.");this.transaction.product={...this.transaction.product,...t.data?.transactionUpdateIntegrationProduct.product},this.transaction.integrationProduct={...this.transaction.integrationProduct,...t.data?.transactionUpdateIntegrationProduct.integrationProduct},this.transaction.workflowState=void 0,this.currentPriceBreak=this.priceBreakToBeApplied(),this.callEvent("ProductChanged");const i=(await this.bundle.getProductCollection().fetchProducts()).find(a=>a.getId()===n.id);try{const a=i?.getDefaultWorkflow();if(a){const s=await sD(a.getId());await this.setWorkflow(s),console.log("Setting Product - Workflow set to default for product.")}}catch{console.log("Setting Product - No default workflow available, must be set manually.")}}async clearProduct(){if(!this.bundle)throw new an("Cannot clear product on experience that is not part of a bundle.");this.workflow=void 0,this.transaction.workflowState=void 0,this.transaction.product=void 0,this.transaction.integrationProduct=void 0,this.currentPriceBreak=this.priceBreakToBeApplied(),this.callEvent("ProductChanged"),await this.graphQlClient().mutate({mutation:VE,variables:{id:this.getTransaction().id}})}getWorkflow(){return this.workflow}async setWorkflow(e){return this.workflow=e,await this.graphQlClient().mutate({mutation:rM,variables:{id:this.getTransaction().id,workflowId:e.id}}),this.workflowManager.setWorkflow(e)}async updateWorkflowConfiguration(e){if(!this.workflow)throw new Error("No workflow set");e.steps&&this.cachedStepHandles.clear();const t=this.applyWorkflowChanges(this.workflow,e);this.workflow=t,await this.workflowManager.updateWorkflowConfiguration(e),this.callEvent("WorkflowConfigurationChanged")}applyWorkflowChanges(e,t){let n={...e};if(t.panels){let i=[...e.panels];if(t.panels.removed&&(i=i.filter(a=>!t.panels.removed.includes(a.name))),t.panels.changed)for(const a of t.panels.changed){const s=i.findIndex(o=>o.name===a.name);s>=0&&(i[s]=a)}if(t.panels.added)for(const{item:a,index:s}of t.panels.added)i.splice(s,0,a);n.panels=i}if(t.steps){let i=[...e.steps];if(t.steps.removed&&(i=i.filter(a=>!t.steps.removed.includes(a.stepName))),t.steps.changed)for(const a of t.steps.changed){const s=i.findIndex(o=>o.stepName===a.stepName);s>=0&&(i[s]=a)}if(t.steps.added)for(const{item:a,index:s}of t.steps.added)i.splice(s,0,a);n.steps=i}if(t.stepGroups){let i=[...e.stepGroups];if(t.stepGroups.removed&&(i=i.filter(a=>a.id&&!t.stepGroups.removed.includes(a.id))),t.stepGroups.changed)for(const a of t.stepGroups.changed){const s=a.id||a.name,o=i.findIndex(l=>l.id===s);o>=0&&(i[o]=a)}if(t.stepGroups.added)for(const{item:a,index:s}of t.stepGroups.added)i.splice(s,0,a);n.stepGroups=i}return n}async attachAddress(e,t,n,i,a,s){await this.graphQlClient().mutate({mutation:CV,variables:{transactionId:this.getTransaction().id,streetAddress:e||void 0,apartment:t||void 0,city:n||void 0,country:i||void 0,state:a||void 0,postCode:s||void 0}})}async attachOrganization(e){await this.graphQlClient().mutate({mutation:SV,variables:{transactionId:this.getTransaction().id,organizationName:e}})}getBundle(){return this.bundle}setBundle(e){this.bundle=e}getClient(){return this.client}getIsReadOnly(){return this.isReadOnly}getCommandContext(){return this.workflowManager.getCommandContext()}getWorkflowManager(){return this.workflowManager}async createPreviewImage(e,t){const n=this.getWorkflow(),i=n?.finalizeStepConfig?.lookAtAnimation;if(!n)throw new Error("Failed to generate cart preview image! No workflow is set.");if(e){if(!i)throw new Error("Failed to generate cart preview image! No camera orientation configured.");return await this.workflowManager.getPreviewService()?.renderSceneScreenshot(t??512,i)||""}let a=2048;t&&t<=2048&&(a=t);const s=Fo(a,a),o=this.workflowManager.getCommandContext().getAllLayouts(),l=n.defaultPreviewPanelIndex||0,u=n.panels[l],c=o.find(S=>S.layoutState?.layout.panelId===u?.name)||o[0],f=c.layoutState.layout.previewRegion?{x:c.layoutState.layout.previewRegion.left,y:c.layoutState.layout.previewRegion.top,width:c.layoutState.layout.previewRegion.width,height:c.layoutState.layout.previewRegion.height}:{x:0,y:0,width:c.layoutState.layout.width,height:c.layoutState.layout.height},d=this.workflowManager.getCommandContext().getLayoutById(c.layoutState.layout.id),h=s.getContext("2d");if(!h)throw new $g("Failed to obtain 2D context for preview image creation");const g=this.workflowManager.getTemplatingContext(),y=Zg(d.layoutState.layout,d.layoutState.elements,{renderingConfiguration:{purpose:tc.Print,region:{left:f.x,top:f.y,width:f.width,height:f.height},templatingContext:g}}),v=iT(y);await(await ho.from(h,v,{anonymousCrossOrigin:!0,ignoreDimensions:!1,createCanvas:Fo,createImage:Uf,DOMParser:i1(),fetch})).render();const x=await this.getCanvasObjectURLAsync(s);return s.toDataURL(x)}getStepById(e){const t=this.getWorkflow()?.steps.find(a=>a.stepName===e);if(!t||!this.stepHasHandle(t))return;const n=this.cachedStepHandles.get(t.stepName);if(n)return n;const i=Fp.get(this.getWorkflowManager(),t);return this.cachedStepHandles.set(t.stepName,i),i}getSteps(){return this.getScenes().flatMap(e=>this.getStepsByScene(e))}async getStepsConditionallyActive(){const e=this.getScenes();return(await Promise.all(e.map(async n=>{const i=this.getStepsByScene(n),a=await Promise.all(i.map(s=>po(s.getRaw(),this.getWorkflowManager().getStepSelections())));return i.filter((s,o)=>a[o])}))).flat()}getScenes(){return(this.getWorkflow()?.stepGroups||[]).map(t=>({id:t.id,name:t.name,stepIds:t.stepNames}))}getSelectionPriceSubunits(e){const t=this.getWorkflowManager().getWorkflowSelections();let n=0;return Object.values(t).forEach(i=>{n+=i.selections.reduce((a,s)=>a+(s.priceModifier||0),0)}),this.getPriceSubUnitsAfterPriceBreaks(n,e)}getBasePriceSubunits(e,t){const n=this.getPriceSubUnitsAfterPriceBreaks(this.getProduct()?.basePrice||0,t);if(e){const i=this.getAdditionalProductPriceSubunits(t)||0;return n+i}return n}getAdditionalProductPriceSubunits(e){const t=this.getTransaction().integrationProduct;if(t?.additionalIntegrationProduct?.product){const n=t.additionalIntegrationProduct.product.basePrice||0;return this.getPriceSubUnitsAfterPriceBreaks(n,e)}}getTotalPriceSubunits(e){return this.getBasePriceSubunits(!1,e)+this.getSelectionPriceSubunits(e)}getPriceSubUnitsAfterPriceBreaks(e,t){const n=t?1:this.priceBreakToBeApplied(),i=e*n;return Math.ceil(i)}priceBreakToBeApplied(){const e=(this.getProduct()?.priceBreaks||[]).sort((i,a)=>-(i.minQty-a.minQty)),n=[...this.getMatchingExperiencesFromBundle(),this].reduce((i,a)=>i+a.getQuantity(),0);for(const i of e)if(i.minQty<=n)return i.percentage;return 1}checkForPriceBreakChanges(){const e=this.priceBreakToBeApplied();this.currentPriceBreak!==e&&(this.updatePriceBreak(e),this.getMatchingExperiencesFromBundle().forEach(t=>t.updatePriceBreak(e)))}getMatchingExperiencesFromBundle(){return(this.bundle?.getWorkflowExperiences()||[]).filter(e=>{const t=e.getTransaction().id,n=this.getTransaction().id,i=e.getProduct()?.id,a=this.getProduct()?.id;return t!==n&&i===a})}updatePriceBreak(e){this.currentPriceBreak=e,this.callEvent("PriceBreakChanged")}async copySelectionsViaGlobalConfiguration(e,t,n){const i=await e.getGlobalProperties(),a=n?.map(u=>u.getId()),s=this.getSteps().filter(u=>a===void 0||a.includes(u.getId())),o=t.getSteps(),l=u=>i.find(c=>c.getRawProperty().name===u.aspectName);s.forEach(u=>{const c=new Set,f=u.getRaw().globalPropertyAspectConfigurations;f!==void 0&&(f.forEach(d=>c.add(JSON.stringify(d))),o.forEach(d=>{const h=d.getRaw().globalPropertyAspectConfigurations;h!==void 0&&h.forEach(g=>{const y=l(g),v=c.has(JSON.stringify(g));if(v&&y?.getType()==="Option"){const A=d.getCurrentVariant();if(!A)return;u.selectVariant(A),c.delete(JSON.stringify(g))}else if(v&&y?.getType()==="Text"){const A=d.getText();u.setText(A),c.delete(JSON.stringify(g))}})}))})}getStepByName(e){const t=this.getWorkflow()?.steps.find(n=>n.stepTitle===e);if(!(!t||!this.stepHasHandle(t)))return Fp.get(this.getWorkflowManager(),t)}getStepsByType(e){return this.getWorkflow()?.steps.filter(t=>t.type===e).map(t=>Fp.get(this.getWorkflowManager(),t))||[]}getStepsByScene(e){const t=this.getWorkflow();if(!t?.stepGroups.find(i=>i.name===e.name))throw new Error("Given scene is not present on workflow! Be careful when persisting scenes that you only use them with the relevant workflow.");return e.stepIds.map(i=>t.steps.find(a=>a.stepName===i)).filter(i=>!!i&&this.stepHasHandle(i)).map(i=>Fp.get(this.getWorkflowManager(),i))}async attachCustomerDetails(e){return this.assignCustomerDetails({emailAddress:e.email})}async assignCustomerDetails(e){const n=(await this.graphQlClient().mutate({mutation:wV,variables:{id:this.getTransaction().id,details:e,type:"Owner"}})).data?.transactionAddStakeholder?.stakeholders?.find(i=>i.customer?.emailAddress===e.emailAddress);n?.customer&&this.assignCustomerInternal(n.customer)}assignCustomerInternal(e){this.getWorkflowManager().setTransactionCustomer(e);const t=wr.getMap("transactionCustomerIds")||new Map;t.set(this.getTransaction().id,e.id),wr.setMap("transactionCustomerIds",t)}attachRenderableSceneListener(e){this.renderableSceneCallbacks.push(e),e(this.renderableScenes)}detachRenderableSceneListener(e){this.renderableSceneCallbacks=this.renderableSceneCallbacks.filter(t=>t!==e)}async save(e){const t=this.getProduct(),n=this.getWorkflow(),i=this.getCommandContext().getState();if(!t)throw new an("Product undefined!");if(!n)throw new an("Workflow undefined!");if(!i)throw new an("State undefined!");const s={title:await(async()=>{if(e)return e;const o=this.getTransaction().id,u=(await eg.getSavedDesigns()).find(c=>c.transactionId===o)?.title;return u||"My design"})(),thumbnail:await this.createPreviewImage(!1,256),transactionId:this.getTransaction().id,productId:t.id,integrationProductId:this.getTransaction().integrationProduct.id,workflowName:n.name,workflowId:n.id,lastEdited:new Date};return await eg.addDesign(s),s}async copy(){const e=Ao(this.getCommandContext().getState());if(!e)throw new an("Internal state is undefined! Cannot copy experience!");const t=JSON.stringify(e.transaction),n=this.getWorkflow();if(!n)throw new an("Workflow is undefined! Cannot copy experience!");const i=this.getTransaction().integrationProduct?.id;if(!i)throw new an("Integration product id is undefined!");return await this.getClient().getWorkflowExperience({type:"integration",integrationProductId:i,workflowId:n.id,workflowState:t})}async onDesignFinished(e=!0){const t=this.getTransaction(),n=this.getProduct(),i=this.getWorkflow();if(!n)throw new an("Product undefined! Cannot finish an experience without a product.");if(!i)throw new an("Workflow undefined! Cannot finish an experience without a workflow.");if(t.isOrdered)return{event:"",exportedData:{},lineItemImageUrl:"",optionsCost:0,transactionId:t.id,workflowViewerLink:"",workflowViewerReadOnlyLink:""};const a=await JI([{workflowManager:this.workflowManager,workflow:i,layouts:this.workflowManager.getLayouts(),getReducerState:()=>this.workflowManager.getCommandContext().getState(),product:n,transaction:t,workflowSelections:this.workflowManager.getWorkflowSelections(),workflowMetadata:this.workflowManager.getWorkflowMetadata(),designName:i.name}],s=>e?this.createPreviewImage(s,1024):Promise.resolve(void 0));return t.completed&&await this.graphQlClient().mutate({mutation:cM,variables:{transactionId:t.id}}),a[0]}stepHasHandle(e){return e.type!==Ye.SilentIllustration&&e.type!==Ye.ProductOverlay}async getExportedStepData(){const e=this.getWorkflow(),t=this.getWorkflowManager().getWorkflowMetadata(),n=this.getWorkflowManager().getWorkflowSelections(),i=[];for(const a of e?.steps||[]){const s=a.stepName,o=t[s],l=n[s]?.selections[0],u={stepId:s,title:a.stepTitle,properties:[]};if(l&&await kV(a,n)&&u.properties.push({type:"selection",value:l.name,priceModifier:l.priceModifier}),!o){i.push(u);continue}switch(a.type){case Ye.Frame:{const c=a.data,f=o;f.image&&c.displayImageOnFinishStep&&u.properties.push({type:"image",value:f.image,priceModifier:0})}break;case Ye.Illustration:{const c=a.data,f=o;if(f&&f.colors&&f.colors.length>0&&c.displayColorsOnFinishStep){const d=f.colors.join(", ").toUpperCase();u.properties.push({type:"color",value:d,priceModifier:0})}}break;case Ye.Module:{const c=a.data,f=o;f&&f.text&&c.displayTextOnFinishStep&&u.properties.push({type:"text",value:f.text,priceModifier:0})}break;case Ye.Text:{const c=a.data,f=o;f&&f.text&&c.displayTextOnFinishStep&&u.properties.push({type:"text",value:f.text,priceModifier:0}),f&&f.color&&c.displayColorOnFinishStep&&u.properties.push({type:"color",value:f.color,priceModifier:0})}}i.push(u)}return i.filter(a=>a.properties&&a.properties.length>0)}getQuantity(){return this.getTransaction().quantity||1}async setQuantity(e){if(e<1)throw new RangeError("WorkflowExperience quantity must be greater than zero.");if(this.isReadOnly)throw new Error("Cannot update quantity on a read-only WorkflowExperience");this.getTransaction().quantity=e,this.callEvent("QuantityChanged"),this.checkForPriceBreakChanges();const t=this.getTransaction();await this.graphQlClient().mutate({mutation:tM,variables:{id:t.id,quantity:e}})}addEventListener(e,t){const n=this.eventCallbacks.get(e)||[];n.push(t),this.eventCallbacks.set(e,n)}removeEventListener(e,t){const n=this.eventCallbacks.get(e)||[];this.eventCallbacks.set(e,n.filter(i=>i!==t))}callEvent(e){(this.eventCallbacks.get(e)||[]).forEach(t=>t(this))}}const EV=r=>{if([Ye.Question,Ye.Frame,Ye.Illustration,Ye.Material,Ye.Model,Ye.Picture,Ye.Shape,Ye.Text].includes(r.type)){const t=r.data;return!!t.displaySelectionOnFinishStep||!!t.displaySelectionsOnFinishStep}return!1},kV=async(r,e)=>{if(!EV(r))return!1;const t=await ct.getOptionForStep(r);if(t&&(t.variants||[]).length>1){const n=e[r.stepName];return!!(n&&n.selections.length>0)}return!1};class TV{constructor(e){this.handleCache={},this.bundle=e}async getHandle(e){if(this.handleCache[e.name])return this.handleCache[e.name];const t=await this.createHandle(e);return this.handleCache[e.name]=t,t}async getHandles(){if(!this.bundle.getGlobalPropertyConfiguration())return[];await this.bundle.getGlobalPropertyStateManager().getInitializationPromise();const e=this.bundle.getGlobalPropertyConfiguration();return e?Promise.all(e.aspects.map(t=>this.getHandle(t))):[]}applyConditionsFromState(e,t){return t?e.filter(n=>this.aspectConditionsSatisfied(n.getRawProperty(),t)):e}aspectConditionsSatisfied(e,t){return!e.conditions||e.conditions.length===0?!0:(e.conditionMode===Wk.AND?Array.prototype.every.bind(e.conditions):Array.prototype.some.bind(e.conditions))(i=>{const a=t.aspects.find(s=>s.name===i.targetAspectName);return a?i.requiredVariantSelections.some(s=>s===a.value):!1})}async createHandle(e){switch(e.type){case Gn.FileUpload:return new KI(this.bundle,e).initialize();case Gn.ColorOption:return new CA(this.bundle,e,e.entityId?await ct.getOption(e.entityId):void 0);case Gn.Option:{const t=e.entityId?await ct.getOption(e.entityId):void 0;return t?.type==="Color"?new CA(this.bundle,e,t):new W1(this.bundle,e,t)}case Gn.Text:return new ZI(this.bundle,e);default:throw new Error("Unhandled Global Property Aspect Type")}}}class rm{constructor(e,t){this.bundle=e,this.property=t}getName(){return this.property.name}getTitle(){return this.property.title}getDescription(){return this.property.description}getType(){return this.property.type}getRawProperty(){return this.property}isMandatory(){return!!this.property.mandatory}isMandatoryFulfilled(){return!this.property.mandatory||!!this.bundle.getGlobalPropertyStateManager().getAspectMandatoryFulfilled(this.property.name)}isSilent(){return!!this.property.silent||this.bundle.getGlobalPropertyStateManager().getAspectHidden(this.property.name)}async getSharedSteps(e){const t=e??this.bundle.getWorkflowExperiences();return(await Promise.all(t.map(a=>a.getStepsConditionallyActive()))).map(a=>a.filter(s=>s.getOverrideGlobalPropertyConfiguration(this.property.type)?!1:s.getRaw().globalPropertyAspectConfigurations?.some(o=>o.globalPropertyConfigurationId===this.bundle.getGlobalPropertyConfiguration()?.id&&o.aspectName===this.property.name))).flat()}getStateValue(){return this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name)}}class KI extends rm{constructor(e,t){super(e,t)}async initialize(){return this.property.data?.fileUpload?.colorOptionId&&(this.colorOption=await ct.getOption(this.property.data?.fileUpload?.colorOptionId)),await this.loadImageData(),this}async loadImageData(){const e=await this.getImage();if(e?.fileLink)if(bf(e.fileLink)==="svg"){const t=await ia(e?.fileLink),n=await B1(e?.fileLink),i=n.width,a=n.height,s=await Ra(t);this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)?.colors?.forEach(u=>{s.colors[u.key]={browserValue:u.browserValue,pmsValue:u.pmsValue}});const l={src:e?.fileLink,width:i,height:a,aspect:i/a,svg:s.svg,colors:s.colors};Os.set(e?.fileLink,l),this.imageData=l}else this.imageData=void 0}async selectImage(e){const t=this.bundle.getGlobalPropertyStateManager();await Promise.all([t.setAspect(this.property.name,e.key,{...t.getAspectStorage(this.property.name)||{},originalAssetKey:e.key,backgroundRemovedAssetKey:void 0,vectorizedAssetKey:void 0,useOriginalAsset:void 0},void 0),this.applyImageSelection(e),this.loadImageData()])}async canUseAdvancedImageManipulation(){return this.bundle.getClient().canUseAddon(Ug.AdvancedImageManipulation)}async removeBackgroundFromImage(e=!0){if(!await this.canUseAdvancedImageManipulation())throw new Error("The current Integration does not have access to the Advanced Image Manipulation addon. Please call canUseAdvancedImageManipulation to ensure you disable this feature when appropriate.");const t=await this.getOriginalImage();if(!t)throw new Error("You must supply an image selection before attempting to remove the background.");const n=this.bundle.getGlobalPropertyStateManager(),i=await Un.removeBackgroundFromAsset(t),s={...n.getAspectStorage(this.property.name),backgroundRemovedAssetKey:i.key,useOriginalAsset:!e},l=[e?n.setAspect(this.property.name,i.key,s):n.setAspectStorage(this.property.name,s)];return e&&(l.push(this.applyImageSelection(i,void 0,!1,!1)),l.push(this.loadImageData())),await Promise.all(l),this.updateSharedStepStorage(s),i}async vectorizeImage(e=!0){if(!await this.canUseAdvancedImageManipulation())throw new Error("The current Integration does not have access to the Advanced Image Manipulation addon. Please call canUseAdvancedImageManipulation to ensure you disable this feature when appropriate.");const t=await this.getOriginalImage();if(!t)throw new Error("You must supply an image selection before attempting to vectorize the image.");const n=this.bundle.getGlobalPropertyStateManager(),i=await Un.vectorizeAsset(t),s={...n.getAspectStorage(this.property.name),vectorizedAssetKey:i.key,useOriginalAsset:!e},l=[e?n.setAspect(this.property.name,i.key,s):n.setAspectStorage(this.property.name,s)];return e&&(l.push(this.applyImageSelection(i,void 0,!1,!1)),l.push(this.loadImageData())),await Promise.all(l),this.updateSharedStepStorage(s),i}hasImage(){return!!this.getStateValue()}async getImage(){const e=this.getStateValue();if(e)return Un.getLocalOrFromServer(e)}async getImageWithColors(){return await this.loadImageData(),this.imageData?.svg?Gg(qg(this.imageData.svg,this.imageData.colors??{},!1)):this.imageData?.src}async getOriginalImage(){const e=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);if(e?.originalAssetKey)return Un.getLocalOrFromServer(e.originalAssetKey)}async getBackgroundRemovedImage(){const e=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);if(e?.backgroundRemovedAssetKey)return Un.getLocalOrFromServer(e.backgroundRemovedAssetKey)}getUseOriginalImage(){return this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)?.useOriginalAsset??!1}async setUseOriginalImage(e){const t=await this.getOriginalImage();if(!t)throw new Error("You must select an image before calling setUseOriginalImage");const n=this.bundle.getGlobalPropertyStateManager(),i=n.getAspectStorage(this.property.name);if(i?.useOriginalAsset===e)return;const a={...i,useOriginalAsset:e},s=e?i?.originalAssetKey:i?.backgroundRemovedAssetKey,o=[n.setAspect(this.property.name,s||"",a)];if(e)o.push(this.applyImageSelection(t,void 0,!1,!1));else{const l=async()=>{const u=await this.getBackgroundRemovedImage();if(!u)throw new Error("You must call removeBackgroundFromImage before attempting to use that version of the image.");this.applyImageSelection(u,void 0,!1,!1)};o.push(l())}o.push(this.loadImageData()),await Promise.all(o),this.updateSharedStepStorage(a)}async applyGlobalState(e){const t=this.getStateValue();if(!t)return;const n=await Un.getLocalOrFromServer(t);if(!n)return;await this.applyImageSelection(n,e,!1,!0);const i=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);if(i){if(this.updateSharedStepStorage({...i}),i.colors){const a=new Map(i.colors.map(s=>[s.key,{browserValue:s.browserValue,pmsValue:s.pmsValue}])??[]);await Promise.all((await this.getSharedSteps(e)).map(async s=>{await s.changeColors(a)}))}}else this.updateSharedStepStorage({originalAssetKey:t}),await this.bundle.getGlobalPropertyStateManager().setAspectStorage(this.property.name,{originalAssetKey:t})}getAvailableColors(){return this.property.data?.fileUpload?.colorPickerEnabled?this.colorOption?.variants?.map(e=>({fill:e.color,stroke:e.color,variant:e,pmsValue:e.name}))??[]:[]}getCurrentColors(){return this.imageData?.colors}isColorPickerEnabled(){return this.property.data?.fileUpload?.colorPickerEnabled??!1}isPmsPickerEnabled(){return this.property.data?.fileUpload?.pmsPickerEnabled??!1}async getOriginalColors(){return this.imageData?.svg?(await Ra(this.imageData.svg)).colors:void 0}async changeColors(e){if(!this.imageData?.svg)return;const t=this.getSharedSteps(),n=new Map(Object.entries(e));await Promise.all((await t).map(async a=>{await a.changeColors(n)}));const i=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspectStorage(this.property.name,{...i,colors:Object.entries(e).map(([a,s])=>({key:a,browserValue:s.browserValue,pmsValue:s.pmsValue}))}),await this.loadImageData()])}async applyImageSelection(e,t,n=!0,i=!0){const s=(await this.getSharedSteps(t)).map(o=>{const l=o;if(l.getFrameService())return l.selectImage(e,n,i)});await Promise.all(s)}updateSharedStepStorage(e){this.bundle.getWorkflowExperiences().forEach(n=>n.getSteps().forEach(i=>{if(i.getOverrideGlobalPropertyConfiguration(this.property.type))return;i.getRaw().globalPropertyAspectConfigurations?.some(s=>s.globalPropertyConfigurationId===this.bundle.getGlobalPropertyConfiguration()?.id&&s.aspectName===this.property.name)&&n.getWorkflowManager().updateStorage(i.getId(),{framePatternData:{originalAssetKey:e.originalAssetKey,backgroundRemovedAssetKey:e.backgroundRemovedAssetKey,useOriginalAsset:e.useOriginalAsset}})}))}}class ZI extends rm{constructor(e,t){super(e,t)}isTemplatingEnabled(){return this.property.data?.text?.templatingEnabled||!1}getText(){const e=this.getStateValue();return e||""}async setText(e){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,e,void 0,void 0),this.applyTextSelection(e)])}async applyGlobalState(e){const t=this.getStateValue();if(!t)return Promise.resolve();await this.applyTextSelection(t,e)}async applyTextSelection(e,t){const i=(await this.getSharedSteps(t)).map(a=>{a.setText(e)});await Promise.all(i)}}class W1 extends rm{constructor(e,t,n){super(e,t),this.optionResource=n}async ensureOptionLoaded(){if(this.optionResource?.variants)return this.optionResource;if(!this.property.entityId)return this.optionResource;const e=await ct.getOption(this.property.entityId);return e&&(this.optionResource=e),this.optionResource}async initDefaultVariant(){await this.ensureOptionLoaded();const e=this.optionResource?.variants?.find(t=>t.id===this.optionResource?.defaultVariant?.id);e&&await this.selectVariant(new Pa(e))}getCurrentVariant(){if(!this.optionResource)return;const e=this.getStateValue();if(e){const t=this.optionResource.variants?.find(n=>n.id===e);return t?new Pa(t):void 0}else{const t=this.optionResource.variants?.find(n=>n.id===this.optionResource?.defaultVariant?.id);return t?new Pa(t):void 0}}async getAvailableVariants(){return await this.ensureOptionLoaded(),(this.optionResource?.variants?.filter(t=>t.enabled)||[]).map(t=>new Pa(t))}async getAllVariants(){return await this.ensureOptionLoaded(),(this.optionResource?.variants||[]).map(t=>new Pa(t))}async selectVariant(e,t){await this.applyVariantSelection(e),await this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,e.getId(),void 0,t)}async applyGlobalState(e){const t=this.getStateValue();if(!t)return;await this.ensureOptionLoaded();const n=this.optionResource?.variants?.find(i=>i.id===t);if(n)return this.applyVariantSelection(new Pa(n),e)}async applyVariantSelection(e,t){const i=(await this.getSharedSteps(t)).map(a=>a.selectVariant(e));await Promise.all(i)}}class CA extends W1{constructor(e,t,n){super(e,t,n)}async selectVariant(e,t){await this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,e.getId(),void 0,t),await this.applyColorVariant(e,void 0,t)}async applyGlobalState(e){const t=this.getStateValue();if(!t)return;await this.ensureOptionLoaded();const n=this.optionResource?.variants?.find(a=>a.id===t);if(!n)return;await this.applyColorVariant(new Pa(n),e);const i=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)?.customColor;i&&await this.setCustomColor(i)}async applyColorVariant(e,t,n){const a=(await this.getSharedSteps(t)).map(s=>{switch(s.getType()){case Ye.Shape:return s.selectVariant(e);case Ye.Text:return s.setFillColor({fill:e.getColor(),stroke:e.getColor(),variant:e.getResource()});case Ye.Illustration:return s.setColor(n?.toString()||"",e.getColor()||"")}});await Promise.all(a)}async setCustomColor(e){const t=this.getCurrentVariant()?.getColor();t&&t.toLowerCase()==="#custom"&&(await this.getSharedSteps()).forEach(i=>i.setCustomColor(e)),this.bundle.getGlobalPropertyStateManager().setAspectStorage(this.property.name,{customColor:e})}getCustomColor(){return this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)?.customColor||this.getCurrentVariant()?.getColor()||"#ffffff"}}const FV=(r,e,t)=>{const n=r.getWorkflowExperiences(),i=r.getGlobalPropertyConfiguration();return i?n.flatMap(s=>s.getSteps()).filter(s=>s.getGlobalPropertyAspects(i.id).includes(e)&&s.getType()===t):[]},eP=(r,e)=>{const n=FV(r,e,Ye.Illustration).map(i=>{if(!i.getCurrentVariant()?.getAssetResource()?.assetConfiguration)return 0;const s=i.getColors();return s?Object.getOwnPropertyNames(s).length:0});return Math.max(...n)};var Hd={exports:{}};Hd.exports;var $E;function IV(){return $E||($E=1,(function(r,e){var t=200,n="Expected a function",i="__lodash_hash_undefined__",a=500,s=1,o=2,l=4,u=800,c=16,f=9007199254740991,d="[object Arguments]",h="[object Array]",g="[object AsyncFunction]",y="[object Boolean]",v="[object Date]",A="[object Error]",x="[object Function]",S="[object GeneratorFunction]",F="[object Map]",E="[object Number]",R="[object Null]",O="[object Object]",W="[object Promise]",Y="[object Proxy]",ae="[object RegExp]",U="[object Set]",$="[object String]",z="[object Symbol]",Q="[object Undefined]",K="[object WeakMap]",le="[object ArrayBuffer]",he="[object DataView]",Me="[object Float32Array]",De="[object Float64Array]",Pe="[object Int8Array]",re="[object Int16Array]",ue="[object Int32Array]",$e="[object Uint8Array]",Je="[object Uint8ClampedArray]",Re="[object Uint16Array]",We="[object Uint32Array]",Ge=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,He=/^\w*$/,ze=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bt=/[\\^$.*+?()[\]{}|]/g,rr=/\\(\\)?/g,Dr=/\w*$/,jt=/^\[object .+?Constructor\]$/,ar=/^(?:0|[1-9]\d*)$/,St={};St[Me]=St[De]=St[Pe]=St[re]=St[ue]=St[$e]=St[Je]=St[Re]=St[We]=!0,St[d]=St[h]=St[le]=St[y]=St[he]=St[v]=St[A]=St[x]=St[F]=St[E]=St[O]=St[ae]=St[U]=St[$]=St[K]=!1;var st={};st[d]=st[h]=st[le]=st[he]=st[y]=st[v]=st[Me]=st[De]=st[Pe]=st[re]=st[ue]=st[F]=st[E]=st[O]=st[ae]=st[U]=st[$]=st[z]=st[$e]=st[Je]=st[Re]=st[We]=!0,st[A]=st[x]=st[K]=!1;var Yr=typeof di=="object"&&di&&di.Object===Object&&di,Sr=typeof self=="object"&&self&&self.Object===Object&&self,gr=Yr||Sr||Function("return this")(),nr=e&&!e.nodeType&&e,dr=nr&&!0&&r&&!r.nodeType&&r,Yt=dr&&dr.exports===nr,Xt=Yt&&Yr.process,mt=(function(){try{var L=dr&&dr.require&&dr.require("util").types;return L||Xt&&Xt.binding&&Xt.binding("util")}catch{}})(),xr=mt&&mt.isMap,on=mt&&mt.isSet,_r=mt&&mt.isTypedArray;function ir(L,ne,oe){switch(oe.length){case 0:return L.call(ne);case 1:return L.call(ne,oe[0]);case 2:return L.call(ne,oe[0],oe[1]);case 3:return L.call(ne,oe[0],oe[1],oe[2])}return L.apply(ne,oe)}function Xr(L,ne){for(var oe=-1,Ue=L==null?0:L.length;++oe<Ue&&ne(L[oe],oe,L)!==!1;);return L}function kr(L,ne){for(var oe=-1,Ue=L==null?0:L.length,pt=0,Mt=[];++oe<Ue;){var Wr=L[oe];ne(Wr,oe,L)&&(Mt[pt++]=Wr)}return Mt}function en(L,ne){for(var oe=-1,Ue=L==null?0:L.length,pt=Array(Ue);++oe<Ue;)pt[oe]=ne(L[oe],oe,L);return pt}function Vr(L,ne){for(var oe=-1,Ue=ne.length,pt=L.length;++oe<Ue;)L[pt+oe]=ne[oe];return L}function gn(L,ne){for(var oe=-1,Ue=Array(L);++oe<L;)Ue[oe]=ne(oe);return Ue}function mn(L){return function(ne){return L(ne)}}function Tr(L,ne){return L?.[ne]}function $r(L,ne){return function(oe){return L(ne(oe))}}var tn=Array.prototype,zr=Function.prototype,Vt=Object.prototype,sr=gr["__core-js_shared__"],Er=zr.toString,tt=Vt.hasOwnProperty,Nr=(function(){var L=/[^.]+$/.exec(sr&&sr.keys&&sr.keys.IE_PROTO||"");return L?"Symbol(src)_1."+L:""})(),Jr=Vt.toString,Se=Er.call(Object),D=RegExp("^"+Er.call(tt).replace(bt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V=Yt?gr.Buffer:void 0,Z=gr.Symbol,ce=gr.Uint8Array;V&&V.allocUnsafe;var ke=$r(Object.getPrototypeOf,Object),je=Vt.propertyIsEnumerable,wt=tn.splice,Dt=Z?Z.isConcatSpreadable:void 0,_t=Z?Z.toStringTag:void 0,or=(function(){try{var L=Lt(Object,"defineProperty");return L({},"",{}),L}catch{}})(),Nt=Object.getOwnPropertySymbols,ee=V?V.isBuffer:void 0,Te=Math.max,qe=Date.now,Qe=Lt(gr,"DataView"),Ct=Lt(gr,"Map"),ft=Lt(gr,"Promise"),Rt=Lt(gr,"Set"),Et=Lt(gr,"WeakMap"),hr=Lt(Object,"create"),tr=hi(Qe),fr=hi(Ct),$t=hi(ft),Mn=hi(Rt),Dn=hi(Et),mr=Z?Z.prototype:void 0,Cr=mr?mr.valueOf:void 0,xn=mr?mr.toString:void 0;function Rr(L){var ne=-1,oe=L==null?0:L.length;for(this.clear();++ne<oe;){var Ue=L[ne];this.set(Ue[0],Ue[1])}}function qn(){this.__data__=hr?hr(null):{},this.size=0}function Cn(L){var ne=this.has(L)&&delete this.__data__[L];return this.size-=ne?1:0,ne}function Hr(L){var ne=this.__data__;if(hr){var oe=ne[L];return oe===i?void 0:oe}return tt.call(ne,L)?ne[L]:void 0}function Sn(L){var ne=this.__data__;return hr?ne[L]!==void 0:tt.call(ne,L)}function dn(L,ne){var oe=this.__data__;return this.size+=this.has(L)?0:1,oe[L]=hr&&ne===void 0?i:ne,this}Rr.prototype.clear=qn,Rr.prototype.delete=Cn,Rr.prototype.get=Hr,Rr.prototype.has=Sn,Rr.prototype.set=dn;function rn(L){var ne=-1,oe=L==null?0:L.length;for(this.clear();++ne<oe;){var Ue=L[ne];this.set(Ue[0],Ue[1])}}function Jn(){this.__data__=[],this.size=0}function si(L){var ne=this.__data__,oe=Jt(ne,L);if(oe<0)return!1;var Ue=ne.length-1;return oe==Ue?ne.pop():wt.call(ne,oe,1),--this.size,!0}function En(L){var ne=this.__data__,oe=Jt(ne,L);return oe<0?void 0:ne[oe][1]}function yn(L){return Jt(this.__data__,L)>-1}function ln(L,ne){var oe=this.__data__,Ue=Jt(oe,L);return Ue<0?(++this.size,oe.push([L,ne])):oe[Ue][1]=ne,this}rn.prototype.clear=Jn,rn.prototype.delete=si,rn.prototype.get=En,rn.prototype.has=yn,rn.prototype.set=ln;function nn(L){var ne=-1,oe=L==null?0:L.length;for(this.clear();++ne<oe;){var Ue=L[ne];this.set(Ue[0],Ue[1])}}function Lr(){this.size=0,this.__data__={hash:new Rr,map:new(Ct||rn),string:new Rr}}function un(L){var ne=zt(this,L).delete(L);return this.size-=ne?1:0,ne}function k(L){return zt(this,L).get(L)}function B(L){return zt(this,L).has(L)}function G(L,ne){var oe=zt(this,L),Ue=oe.size;return oe.set(L,ne),this.size+=oe.size==Ue?0:1,this}nn.prototype.clear=Lr,nn.prototype.delete=un,nn.prototype.get=k,nn.prototype.has=B,nn.prototype.set=G;function X(L){var ne=this.__data__=new rn(L);this.size=ne.size}function pe(){this.__data__=new rn,this.size=0}function de(L){var ne=this.__data__,oe=ne.delete(L);return this.size=ne.size,oe}function xe(L){return this.__data__.get(L)}function Be(L){return this.__data__.has(L)}function rt(L,ne){var oe=this.__data__;if(oe instanceof rn){var Ue=oe.__data__;if(!Ct||Ue.length<t-1)return Ue.push([L,ne]),this.size=++oe.size,this;oe=this.__data__=new nn(Ue)}return oe.set(L,ne),this.size=oe.size,this}X.prototype.clear=pe,X.prototype.delete=de,X.prototype.get=xe,X.prototype.has=Be,X.prototype.set=rt;function ut(L,ne){var oe=Fi(L),Ue=!oe&&hs(L),pt=!oe&&!Ue&&ps(L),Mt=!oe&&!Ue&&!pt&&ve(L),Wr=oe||Ue||pt||Mt,Hn=Wr?gn(L.length,String):[],oi=Hn.length;for(var Hi in L)Wr&&(Hi=="length"||pt&&(Hi=="offset"||Hi=="parent")||Mt&&(Hi=="buffer"||Hi=="byteLength"||Hi=="byteOffset")||Xe(Hi,oi))||Hn.push(Hi);return Hn}function nt(L,ne,oe){var Ue=L[ne];(!(tt.call(L,ne)&&fs(Ue,oe))||oe===void 0&&!(ne in L))&&yr(L,ne,oe)}function Jt(L,ne){for(var oe=L.length;oe--;)if(fs(L[oe][0],ne))return oe;return-1}function yr(L,ne,oe){ne=="__proto__"&&or?or(L,ne,{configurable:!0,enumerable:!0,value:oe,writable:!0}):L[ne]=oe}function Gr(L,ne,oe,Ue,pt,Mt){var Wr;if(oe&&(Wr=pt?oe(L,Ue,pt,Mt):oe(L)),Wr!==void 0)return Wr;if(!ca(L))return L;var Hn=Fi(L);if(Hn)Wr=Ae(L);else{var oi=fe(L),Hi=oi==x||oi==S;if(ps(L))return Zn(L);if(oi==O||oi==d||Hi&&!pt)Wr={};else{if(!st[oi])return pt?L:{};Wr=Oe(L,oi)}}Mt||(Mt=new X);var Ul=Mt.get(L);if(Ul)return Ul;Mt.set(L,Wr),H(L)?L.forEach(function(da){Wr.add(Gr(da,ne,oe,da,L,Mt))}):T(L)&&L.forEach(function(da,Aa){Wr.set(Aa,Gr(da,ne,oe,Aa,L,Mt))});var Vl=lt,Uo=Hn?void 0:Vl(L);return Xr(Uo||L,function(da,Aa){Uo&&(Aa=da,da=L[Aa]),nt(Wr,Aa,Gr(da,ne,oe,Aa,L,Mt))}),Wr}function fn(L,ne,oe,Ue,pt){var Mt=-1,Wr=L.length;for(oe||(oe=Ke),pt||(pt=[]);++Mt<Wr;){var Hn=L[Mt];oe(Hn)?Vr(pt,Hn):pt[pt.length]=Hn}return pt}function Kn(L,ne){ne=kn(ne,L);for(var oe=0,Ue=ne.length;L!=null&&oe<Ue;)L=L[Ji(ne[oe++])];return oe&&oe==Ue?L:void 0}function $n(L,ne,oe){var Ue=ne(L);return Fi(L)?Ue:Vr(Ue,oe(L))}function vn(L){return L==null?L===void 0?Q:R:_t&&_t in Object(L)?Br(L):jr(L)}function Or(L){return zi(L)&&vn(L)==d}function Wn(L){return zi(L)&&fe(L)==F}function _n(L){if(!ca(L)||pr(L))return!1;var ne=gs(L)?D:jt;return ne.test(hi(L))}function Nn(L){return zi(L)&&fe(L)==U}function Oi(L){return zi(L)&&ms(L.length)&&!!St[vn(L)]}function wi(L){if(!ca(L))return Fr(L);var ne=vr(L),oe=[];for(var Ue in L)Ue=="constructor"&&(ne||!tt.call(L,Ue))||oe.push(Ue);return oe}var xi=or?function(L,ne){return or(L,"toString",{configurable:!0,enumerable:!1,value:Bt(ne),writable:!0})}:Kt;function Ln(L,ne,oe){var Ue=-1,pt=L.length;ne<0&&(ne=-ne>pt?0:pt+ne),oe=oe>pt?pt:oe,oe<0&&(oe+=pt),pt=ne>oe?0:oe-ne>>>0,ne>>>=0;for(var Mt=Array(pt);++Ue<pt;)Mt[Ue]=L[Ue+ne];return Mt}function Ti(L){if(typeof L=="string")return L;if(Fi(L))return en(L,Ti)+"";if(J(L))return xn?xn.call(L):"";var ne=L+"";return ne=="0"&&1/L==-1/0?"-0":ne}function zn(L,ne){ne=kn(ne,L);var oe=-1,Ue=ne.length;if(!Ue)return!0;for(;++oe<Ue;){var pt=Ji(ne[oe]);if(pt==="__proto__"&&!tt.call(L,"__proto__")||(pt==="constructor"||pt==="prototype")&&oe<Ue-1)return!1}var Mt=Yi(L,ne);return Mt==null||delete Mt[Ji(za(ne))]}function kn(L,ne){return Fi(L)?L:vt(L,ne)?[L]:Qn(ye(L))}function Zn(L,ne){return L.slice()}function lr(L){var ne=new L.constructor(L.byteLength);return new ce(ne).set(new ce(L)),ne}function Rn(L,ne){var oe=lr(L.buffer);return new L.constructor(oe,L.byteOffset,L.byteLength)}function Ci(L){var ne=new L.constructor(L.source,Dr.exec(L));return ne.lastIndex=L.lastIndex,ne}function I(L){return Cr?Object(Cr.call(L)):{}}function j(L,ne){var oe=lr(L.buffer);return new L.constructor(oe,L.byteOffset,L.length)}function se(L,ne,oe,Ue){var pt=!oe;oe||(oe={});for(var Mt=-1,Wr=ne.length;++Mt<Wr;){var Hn=ne[Mt],oi=void 0;oi===void 0&&(oi=L[Hn]),pt?yr(oe,Hn,oi):nt(oe,Hn,oi)}return oe}function we(L){return _(L)?void 0:L}function ht(L){return la(An(L,void 0,$a),L+"")}function lt(L){return $n(L,Ee,te)}function zt(L,ne){var oe=L.__data__;return Ot(ne)?oe[typeof ne=="string"?"string":"hash"]:oe.map}function Lt(L,ne){var oe=Tr(L,ne);return _n(oe)?oe:void 0}function Br(L){var ne=tt.call(L,_t),oe=L[_t];try{L[_t]=void 0;var Ue=!0}catch{}var pt=Jr.call(L);return Ue&&(ne?L[_t]=oe:delete L[_t]),pt}var M=Nt?function(L){return L==null?[]:(L=Object(L),kr(Nt(L),function(ne){return je.call(L,ne)}))}:qt,te=Nt?function(L){for(var ne=[];L;)Vr(ne,M(L)),L=ke(L);return ne}:qt,fe=vn;(Qe&&fe(new Qe(new ArrayBuffer(1)))!=he||Ct&&fe(new Ct)!=F||ft&&fe(ft.resolve())!=W||Rt&&fe(new Rt)!=U||Et&&fe(new Et)!=K)&&(fe=function(L){var ne=vn(L),oe=ne==O?L.constructor:void 0,Ue=oe?hi(oe):"";if(Ue)switch(Ue){case tr:return he;case fr:return F;case $t:return W;case Mn:return U;case Dn:return K}return ne});function Ae(L){var ne=L.length,oe=new L.constructor(ne);return ne&&typeof L[0]=="string"&&tt.call(L,"index")&&(oe.index=L.index,oe.input=L.input),oe}function Oe(L,ne,oe){var Ue=L.constructor;switch(ne){case le:return lr(L);case y:case v:return new Ue(+L);case he:return Rn(L);case Me:case De:case Pe:case re:case ue:case $e:case Je:case Re:case We:return j(L);case F:return new Ue;case E:case $:return new Ue(L);case ae:return Ci(L);case U:return new Ue;case z:return I(L)}}function Ke(L){return Fi(L)||hs(L)||!!(Dt&&L&&L[Dt])}function Xe(L,ne){var oe=typeof L;return ne=ne??f,!!ne&&(oe=="number"||oe!="symbol"&&ar.test(L))&&L>-1&&L%1==0&&L<ne}function vt(L,ne){if(Fi(L))return!1;var oe=typeof L;return oe=="number"||oe=="symbol"||oe=="boolean"||L==null||J(L)?!0:He.test(L)||!Ge.test(L)||ne!=null&&L in Object(ne)}function Ot(L){var ne=typeof L;return ne=="string"||ne=="number"||ne=="symbol"||ne=="boolean"?L!=="__proto__":L===null}function pr(L){return!!Nr&&Nr in L}function vr(L){var ne=L&&L.constructor,oe=typeof ne=="function"&&ne.prototype||Vt;return L===oe}function ur(L){var ne=ua(L,function(Ue){return oe.size===a&&oe.clear(),Ue}),oe=ne.cache;return ne}function Fr(L){var ne=[];if(L!=null)for(var oe in Object(L))ne.push(oe);return ne}function jr(L){return Jr.call(L)}function An(L,ne,oe){return ne=Te(ne===void 0?L.length-1:ne,0),function(){for(var Ue=arguments,pt=-1,Mt=Te(Ue.length-ne,0),Wr=Array(Mt);++pt<Mt;)Wr[pt]=Ue[ne+pt];pt=-1;for(var Hn=Array(ne+1);++pt<ne;)Hn[pt]=Ue[pt];return Hn[ne]=oe(Wr),ir(L,this,Hn)}}function Yi(L,ne){return ne.length<2?L:Kn(L,Ln(ne,0,-1))}var la=Xi(xi);function Xi(L){var ne=0,oe=0;return function(){var Ue=qe(),pt=c-(Ue-oe);if(oe=Ue,pt>0){if(++ne>=u)return arguments[0]}else ne=0;return L.apply(void 0,arguments)}}var Qn=ur(function(L){var ne=[];return L.charCodeAt(0)===46&&ne.push(""),L.replace(ze,function(oe,Ue,pt,Mt){ne.push(pt?Mt.replace(rr,"$1"):Ue||oe)}),ne});function Ji(L){if(typeof L=="string"||J(L))return L;var ne=L+"";return ne=="0"&&1/L==-1/0?"-0":ne}function hi(L){if(L!=null){try{return Er.call(L)}catch{}try{return L+""}catch{}}return""}function $a(L){var ne=L==null?0:L.length;return ne?fn(L):[]}function za(L){var ne=L==null?0:L.length;return ne?L[ne-1]:void 0}function ua(L,ne){if(typeof L!="function"||ne!=null&&typeof ne!="function")throw new TypeError(n);var oe=function(){var Ue=arguments,pt=ne?ne.apply(this,Ue):Ue[0],Mt=oe.cache;if(Mt.has(pt))return Mt.get(pt);var Wr=L.apply(this,Ue);return oe.cache=Mt.set(pt,Wr)||Mt,Wr};return oe.cache=new(ua.Cache||nn),oe}ua.Cache=nn;function fs(L,ne){return L===ne||L!==L&&ne!==ne}var hs=Or((function(){return arguments})())?Or:function(L){return zi(L)&&tt.call(L,"callee")&&!je.call(L,"callee")},Fi=Array.isArray;function Ha(L){return L!=null&&ms(L.length)&&!gs(L)}var ps=ee||qr;function gs(L){if(!ca(L))return!1;var ne=vn(L);return ne==x||ne==S||ne==g||ne==Y}function ms(L){return typeof L=="number"&&L>-1&&L%1==0&&L<=f}function ca(L){var ne=typeof L;return L!=null&&(ne=="object"||ne=="function")}function zi(L){return L!=null&&typeof L=="object"}var T=xr?mn(xr):Wn;function _(L){if(!zi(L)||vn(L)!=O)return!1;var ne=ke(L);if(ne===null)return!0;var oe=tt.call(ne,"constructor")&&ne.constructor;return typeof oe=="function"&&oe instanceof oe&&Er.call(oe)==Se}var H=on?mn(on):Nn;function J(L){return typeof L=="symbol"||zi(L)&&vn(L)==z}var ve=_r?mn(_r):Oi;function ye(L){return L==null?"":Ti(L)}function Ee(L){return Ha(L)?ut(L):wi(L)}var Ve=ht(function(L,ne){var oe={};if(L==null)return oe;var Ue=!1;ne=en(ne,function(Mt){return Mt=kn(Mt,L),Ue||(Ue=Mt.length>1),Mt}),se(L,lt(L),oe),Ue&&(oe=Gr(oe,s|o|l,we));for(var pt=ne.length;pt--;)zn(oe,ne[pt]);return oe});function Bt(L){return function(){return L}}function Kt(L){return L}function qt(){return[]}function qr(){return!1}r.exports=Ve})(Hd,Hd.exports)),Hd.exports}var PV=IV();const DV=Us(PV);function SA(r,e){function t(n){if(typeof n>"u"||!Array.isArray(n)&&!OV(n))return n;if(Array.isArray(n))return SA(n,e);let i={};for(const[a,s]of Object.entries(n))i[a]=RV(s)?s:SA(s,e);return DV(i,e)}return Array.isArray(r)?r.map(t):t(r)}function RV(r){return r==null}function OV(r){return typeof r=="object"&&!Array.isArray(r)&&r!==null}function zE(r,e){return r==null&&e==null?!0:r===e}function tP(r){const e=new Map;return r?.aspects?.forEach(t=>{t.value!==""&&e.set(t.name,!0)}),e}class BV extends Yg{constructor(e){super(),this.update=e}async execute(){await this.update(),await new Promise(e=>{window.setTimeout(()=>{e()},1e3)})}}function Ny(r){return SA(r,["__typename"])}class MV{constructor(e,t,n,i,a){this.stateUpdateQueue=new Xg(1),this.mandatoryFulfilledAspects=new Map,this.bundleId=e,this.bundleOwnerId=t,this.configuration=n,this.bundleOptions=a;const s=a?.existingGlobalPropertyState;this.initPromise=s?Promise.resolve(s).then(()=>{console.log("Setting global property state to existing state."),this.globalPropertyState=Ny(s),this.recalculateMandatoryStates()}):this.createGlobalPropertyState().then(o=>{console.log("Setting global property state to new state."),this.globalPropertyState=Ny(o),this.recalculateMandatoryStates()}),this.onGlobalPropertyStateChange=i}async clearAspects(e){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=this.globalPropertyState.aspects;this.globalPropertyState.aspects=t.filter(n=>!e.includes(n.name))}recalculateMandatoryStates(){this.mandatoryFulfilledAspects=tP(this.globalPropertyState)}setBundleOptions(e){this.bundleOptions=e}getBundleOptions(){return this.bundleOptions}setConfiguration(e){this.configuration=e}getInitializationPromise(){return this.initPromise}getGlobalPropertyState(){return this.globalPropertyState}async setGlobalPropertyState(e){this.globalPropertyState||await this.initPromise;const t=Ao(this.globalPropertyState);this.globalPropertyState={...Ny(e),id:t.id},this.recalculateMandatoryStates(),this.queueGlobalPropertyStateUpdate(),await this.onGlobalPropertyStateChange(t,this.globalPropertyState)}getAspectMandatoryFulfilled(e){return this.mandatoryFulfilledAspects.get(e)}getAspectHidden(e){if(!this.globalPropertyState)throw new Error("Global property state not initialized");return!!this.globalPropertyState.aspects.find(t=>t.name===e)?.hidden}getAspect(e,t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const n=this.globalPropertyState.aspects.find(i=>i.name===e&&zE(i.channel,t));if(n)return n.value}getAspectStorage(e,t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");return this.globalPropertyState.aspects.find(n=>n.name===e&&zE(n.channel,t))?.storage}async setAspect(e,t,n,i,a){if(!this.globalPropertyState)throw new Error("Global property state not initialized");if(!this.configuration)throw new Error("Global property configuration not linked to the state manager.");const s=this.configuration.aspects.find(u=>u.name===e);if(!s)throw new Error(`Failed to find configuration aspect with name: ${e}`);this.mandatoryFulfilledAspects.set(e,t!=="");const o=Ao(this.globalPropertyState),l=this.globalPropertyState.aspects.filter(u=>u.name===e);if(l.length>0)if(i){const u=l.find(c=>c.channel===i);if(u)u.value=t,u.type=s.type,u.channel=i,u.hidden=a??u.hidden,n!==void 0&&(u.storage=n!==null?n:void 0);else{let c;if(i===1){const f=this.globalPropertyState.aspects.findIndex(d=>!d.channel&&d.name===e);f&&f>0&&(c=this.globalPropertyState.aspects.splice(f,1)[0].hidden)}this.globalPropertyState.aspects.push({name:e,value:t,type:s.type,storage:n!==null?n:void 0,channel:i,hidden:a??c})}}else{const u=l[0];u.value=t,u.type=s.type,u.hidden=a??u.hidden,n!==void 0&&(u.storage=n!==null?n:void 0)}else this.globalPropertyState.aspects.push({name:e,value:t,type:s.type,storage:n!==null?n:void 0,channel:i,hidden:a});wf(o,this.globalPropertyState)||(this.queueGlobalPropertyStateUpdate(),await this.onGlobalPropertyStateChange(o,this.globalPropertyState))}async setAspectStorage(e,t,n){if(!this.globalPropertyState)throw new Error("Global property state not initialized");if(!this.configuration)throw new Error("Global property configuration not linked to the state manager.");const i=this.configuration.aspects.find(o=>o.name===e);if(!i)throw new Error(`Failed to find configuration aspect with name: ${e}`);const a=Ao(this.globalPropertyState),s=this.globalPropertyState.aspects.filter(o=>o.name===e);if(s.length>0)if(n){const o=s.find(l=>l.channel===n);o&&(o.storage=t!==null?t:void 0,o.type=i.type)}else{const o=s[0];o.storage=t!==null?t:void 0,o.type=i.type}else this.globalPropertyState.aspects.push({name:e,value:"",type:i.type,storage:t!==null?t:void 0,channel:n});wf(a,this.globalPropertyState)||(this.queueGlobalPropertyStateUpdate(),await this.onGlobalPropertyStateChange(a,this.globalPropertyState))}queueGlobalPropertyStateUpdate(){this.stateUpdateQueue.enqueue(new BV(async()=>{await this.updateGlobalPropertyState()}))}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");if(!(await Le.getShadowGraphqlClient().mutate({mutation:E9,variables:{id:this.globalPropertyState.id,aspects:this.globalPropertyState.aspects.map(t=>{let n=t.type&&t.storage?{}:void 0;if(n)switch(t.type){case Gn.FileUpload:{n.fileUpload=t.storage;break}case Gn.ColorOption:case Gn.Option:{n.option=t.storage;break}}return{name:t.name,value:t.value,type:t.type,storage:n,channel:t.channel,hidden:t.hidden}})},context:{headers:{bundleOwnerId:this.bundleOwnerId,...this.bundleOptions?.additionalHeaders}}})).data?.globalPropertyStateUpdate)throw new Error("Unable to update global property state")}async createGlobalPropertyState(){const e=await Le.getShadowGraphqlClient().mutate({mutation:S9,variables:{bundleId:this.bundleId},context:{headers:{bundleOwnerId:this.bundleOwnerId,...this.bundleOptions?.additionalHeaders}}});if(e.data?.globalPropertyStateCreate&&e.data.globalPropertyStateCreate.id)return e.data.globalPropertyStateCreate;throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`)}}class _V{constructor(e){this.setState(e||'{"transactions": []}')}setState(e){e&&(this.state=JSON.parse(e))}getState(){return this.state}removeStateForTransaction(e){if(!this.state||!this.state.transactions)return;const t=this.state.transactions.findIndex(n=>n.transactionId===e);t!==-1&&this.state.transactions.splice(t,1)}getSerializedState(){if(this.state)return this.deleteFieldNameFromObjectRecursive(this.state,"__typename"),JSON.stringify(this.state)}deleteFieldNameFromObjectRecursive(e,t){if(!(typeof e!="object"||e===null))for(const n in e)n===t?delete e[n]:this.deleteFieldNameFromObjectRecursive(e[n],t)}}const NV=Ce`
|
|
2844
|
+
`;var Cg=(r=>(r.PriceBreakChanged="PriceBreakChanged",r.ProductChanged="ProductChanged",r.QuantityChanged="QuantityChanged",r.RecipientChanged="RecipientChanged",r.SelectionChanged="SelectionChanged",r.WorkflowConfigurationChanged="WorkflowConfigurationChanged",r))(Cg||{});class q1{constructor(e,t){this.cachedStepHandles=new Map,this.profanityList=[],this.currentPriceBreak=1,this.renderableScenes=[],this.renderableSceneCallbacks=[],this.eventCallbacks=new Map,this.debouncedSavedDesignUpdate=v1(async()=>{await eg.getSavedDesignByTransaction(this.getTransaction().id)&&this.save()},2500),this.getCanvasObjectURLAsync=async n=>new Promise((i,a)=>{try{n.toBlob(s=>{if(s){const o=URL.createObjectURL(s);i(o)}})}catch(s){a(s)}}),this.client=e,this.transaction=t.transaction,this.workflow=t.workflow,this.profanityList=this.transaction.product?.profanities?.map(n=>n.word)||[],this.isReadOnly=t.transaction.isOrdered||!!t.readOnly,this.graphQlClient=t.graphQlClient,this.workflowManager=new wA(this,e,n=>{try{this.debouncedSavedDesignUpdate()}catch{console.error("Failed to update saved design details.")}return t.stateMutationFunc(n)},t.graphQlClient,t.reloadedState,t.readOnly,t.modelContainer,t.isReloadedTransaction,t.singleVariantsRenderable,t.delayWorkflowStateSync),this.workflowManager.addSelectionCallback(n=>{const i=n.traversableScenes.map(a=>{const s=a.renderableSteps.map(o=>o.stepName);return{id:a.name,title:a.title,renderableSteps:s,workflowScene:a}});this.renderableScenes=i,this.renderableSceneCallbacks.forEach(a=>a(i)),this.callEvent("SelectionChanged")}),this.currentPriceBreak=this.priceBreakToBeApplied()}getTransaction(){return this.transaction}getProduct(){return this.transaction.product}getProfanityList(){return this.profanityList}async setProduct(e){this.workflow=void 0;const t=await this.graphQlClient().mutate({mutation:VE,variables:{id:this.getTransaction().id,integrationProductId:e}}),n=t.data?.transactionUpdateIntegrationProduct.product;if(!n)throw new an("Failed to set product. No product returned from server.");if(!this.bundle)throw new an("Cannot set product on experience that is not part of a bundle.");this.transaction.product={...this.transaction.product,...t.data?.transactionUpdateIntegrationProduct.product},this.transaction.integrationProduct={...this.transaction.integrationProduct,...t.data?.transactionUpdateIntegrationProduct.integrationProduct},this.transaction.workflowState=void 0,this.currentPriceBreak=this.priceBreakToBeApplied(),this.callEvent("ProductChanged");const i=(await this.bundle.getProductCollection().fetchProducts()).find(a=>a.getId()===n.id);try{const a=i?.getDefaultWorkflow();if(a){const s=await sD(a.getId());await this.setWorkflow(s),console.log("Setting Product - Workflow set to default for product.")}}catch{console.log("Setting Product - No default workflow available, must be set manually.")}}async clearProduct(){if(!this.bundle)throw new an("Cannot clear product on experience that is not part of a bundle.");this.workflow=void 0,this.transaction.workflowState=void 0,this.transaction.product=void 0,this.transaction.integrationProduct=void 0,this.currentPriceBreak=this.priceBreakToBeApplied(),this.callEvent("ProductChanged"),await this.graphQlClient().mutate({mutation:VE,variables:{id:this.getTransaction().id}})}getWorkflow(){return this.workflow}async setWorkflow(e){return this.workflow=e,await this.graphQlClient().mutate({mutation:rM,variables:{id:this.getTransaction().id,workflowId:e.id}}),this.workflowManager.setWorkflow(e)}async updateWorkflowConfiguration(e){if(!this.workflow)throw new Error("No workflow set");e.steps&&this.cachedStepHandles.clear();const t=this.applyWorkflowChanges(this.workflow,e);this.workflow=t,await this.workflowManager.updateWorkflowConfiguration(e),this.callEvent("WorkflowConfigurationChanged")}applyWorkflowChanges(e,t){let n={...e};if(t.panels){let i=[...e.panels];if(t.panels.removed&&(i=i.filter(a=>!t.panels.removed.includes(a.name))),t.panels.changed)for(const a of t.panels.changed){const s=i.findIndex(o=>o.name===a.name);s>=0&&(i[s]=a)}if(t.panels.added)for(const{item:a,index:s}of t.panels.added)i.splice(s,0,a);n.panels=i}if(t.steps){let i=[...e.steps];if(t.steps.removed&&(i=i.filter(a=>!t.steps.removed.includes(a.stepName))),t.steps.changed)for(const a of t.steps.changed){const s=i.findIndex(o=>o.stepName===a.stepName);s>=0&&(i[s]=a)}if(t.steps.added)for(const{item:a,index:s}of t.steps.added)i.splice(s,0,a);n.steps=i}if(t.stepGroups){let i=[...e.stepGroups];if(t.stepGroups.removed&&(i=i.filter(a=>a.id&&!t.stepGroups.removed.includes(a.id))),t.stepGroups.changed)for(const a of t.stepGroups.changed){const s=a.id||a.name,o=i.findIndex(l=>l.id===s);o>=0&&(i[o]=a)}if(t.stepGroups.added)for(const{item:a,index:s}of t.stepGroups.added)i.splice(s,0,a);n.stepGroups=i}return n}async attachAddress(e,t,n,i,a,s){await this.graphQlClient().mutate({mutation:SV,variables:{transactionId:this.getTransaction().id,streetAddress:e||void 0,apartment:t||void 0,city:n||void 0,country:i||void 0,state:a||void 0,postCode:s||void 0}})}async attachOrganization(e){await this.graphQlClient().mutate({mutation:EV,variables:{transactionId:this.getTransaction().id,organizationName:e}})}getBundle(){return this.bundle}setBundle(e){this.bundle=e}getClient(){return this.client}getIsReadOnly(){return this.isReadOnly}getCommandContext(){return this.workflowManager.getCommandContext()}getWorkflowManager(){return this.workflowManager}async createPreviewImage(e,t){const n=this.getWorkflow(),i=n?.finalizeStepConfig?.lookAtAnimation;if(!n)throw new Error("Failed to generate cart preview image! No workflow is set.");if(e){if(!i)throw new Error("Failed to generate cart preview image! No camera orientation configured.");return await this.workflowManager.getPreviewService()?.renderSceneScreenshot(t??512,i)||""}let a=2048;t&&t<=2048&&(a=t);const s=Fo(a,a),o=this.workflowManager.getCommandContext().getAllLayouts(),l=n.defaultPreviewPanelIndex||0,u=n.panels[l],c=o.find(S=>S.layoutState?.layout.panelId===u?.name)||o[0],f=c.layoutState.layout.previewRegion?{x:c.layoutState.layout.previewRegion.left,y:c.layoutState.layout.previewRegion.top,width:c.layoutState.layout.previewRegion.width,height:c.layoutState.layout.previewRegion.height}:{x:0,y:0,width:c.layoutState.layout.width,height:c.layoutState.layout.height},d=this.workflowManager.getCommandContext().getLayoutById(c.layoutState.layout.id),h=s.getContext("2d");if(!h)throw new $g("Failed to obtain 2D context for preview image creation");const g=this.workflowManager.getTemplatingContext(),y=Zg(d.layoutState.layout,d.layoutState.elements,{renderingConfiguration:{purpose:tc.Print,region:{left:f.x,top:f.y,width:f.width,height:f.height},templatingContext:g}}),v=iT(y);await(await ho.from(h,v,{anonymousCrossOrigin:!0,ignoreDimensions:!1,createCanvas:Fo,createImage:Uf,DOMParser:i1(),fetch})).render();const x=await this.getCanvasObjectURLAsync(s);return s.toDataURL(x)}getStepById(e){const t=this.getWorkflow()?.steps.find(a=>a.stepName===e);if(!t||!this.stepHasHandle(t))return;const n=this.cachedStepHandles.get(t.stepName);if(n)return n;const i=Fp.get(this.getWorkflowManager(),t);return this.cachedStepHandles.set(t.stepName,i),i}getSteps(){return this.getScenes().flatMap(e=>this.getStepsByScene(e))}async getStepsConditionallyActive(){const e=this.getScenes();return(await Promise.all(e.map(async n=>{const i=this.getStepsByScene(n),a=await Promise.all(i.map(s=>po(s.getRaw(),this.getWorkflowManager().getStepSelections())));return i.filter((s,o)=>a[o])}))).flat()}getScenes(){return(this.getWorkflow()?.stepGroups||[]).map(t=>({id:t.id,name:t.name,stepIds:t.stepNames}))}getSelectionPriceSubunits(e){const t=this.getWorkflowManager().getWorkflowSelections();let n=0;return Object.values(t).forEach(i=>{n+=i.selections.reduce((a,s)=>a+(s.priceModifier||0),0)}),this.getPriceSubUnitsAfterPriceBreaks(n,e)}getBasePriceSubunits(e,t){const n=this.getPriceSubUnitsAfterPriceBreaks(this.getProduct()?.basePrice||0,t);if(e){const i=this.getAdditionalProductPriceSubunits(t)||0;return n+i}return n}getAdditionalProductPriceSubunits(e){const t=this.getTransaction().integrationProduct;if(t?.additionalIntegrationProduct?.product){const n=t.additionalIntegrationProduct.product.basePrice||0;return this.getPriceSubUnitsAfterPriceBreaks(n,e)}}getTotalPriceSubunits(e){return this.getBasePriceSubunits(!1,e)+this.getSelectionPriceSubunits(e)}getPriceSubUnitsAfterPriceBreaks(e,t){const n=t?1:this.priceBreakToBeApplied(),i=e*n;return Math.ceil(i)}priceBreakToBeApplied(){const e=(this.getProduct()?.priceBreaks||[]).sort((i,a)=>-(i.minQty-a.minQty)),n=[...this.getMatchingExperiencesFromBundle(),this].reduce((i,a)=>i+a.getQuantity(),0);for(const i of e)if(i.minQty<=n)return i.percentage;return 1}checkForPriceBreakChanges(){const e=this.priceBreakToBeApplied();this.currentPriceBreak!==e&&(this.updatePriceBreak(e),this.getMatchingExperiencesFromBundle().forEach(t=>t.updatePriceBreak(e)))}getMatchingExperiencesFromBundle(){return(this.bundle?.getWorkflowExperiences()||[]).filter(e=>{const t=e.getTransaction().id,n=this.getTransaction().id,i=e.getProduct()?.id,a=this.getProduct()?.id;return t!==n&&i===a})}updatePriceBreak(e){this.currentPriceBreak=e,this.callEvent("PriceBreakChanged")}async copySelectionsViaGlobalConfiguration(e,t,n){const i=await e.getGlobalProperties(),a=n?.map(u=>u.getId()),s=this.getSteps().filter(u=>a===void 0||a.includes(u.getId())),o=t.getSteps(),l=u=>i.find(c=>c.getRawProperty().name===u.aspectName);s.forEach(u=>{const c=new Set,f=u.getRaw().globalPropertyAspectConfigurations;f!==void 0&&(f.forEach(d=>c.add(JSON.stringify(d))),o.forEach(d=>{const h=d.getRaw().globalPropertyAspectConfigurations;h!==void 0&&h.forEach(g=>{const y=l(g),v=c.has(JSON.stringify(g));if(v&&y?.getType()==="Option"){const A=d.getCurrentVariant();if(!A)return;u.selectVariant(A),c.delete(JSON.stringify(g))}else if(v&&y?.getType()==="Text"){const A=d.getText();u.setText(A),c.delete(JSON.stringify(g))}})}))})}getStepByName(e){const t=this.getWorkflow()?.steps.find(n=>n.stepTitle===e);if(!(!t||!this.stepHasHandle(t)))return Fp.get(this.getWorkflowManager(),t)}getStepsByType(e){return this.getWorkflow()?.steps.filter(t=>t.type===e).map(t=>Fp.get(this.getWorkflowManager(),t))||[]}getStepsByScene(e){const t=this.getWorkflow();if(!t?.stepGroups.find(i=>i.name===e.name))throw new Error("Given scene is not present on workflow! Be careful when persisting scenes that you only use them with the relevant workflow.");return e.stepIds.map(i=>t.steps.find(a=>a.stepName===i)).filter(i=>!!i&&this.stepHasHandle(i)).map(i=>Fp.get(this.getWorkflowManager(),i))}async attachCustomerDetails(e){return this.assignCustomerDetails({emailAddress:e.email})}async assignCustomerDetails(e){const n=(await this.graphQlClient().mutate({mutation:xV,variables:{id:this.getTransaction().id,details:e,type:"Owner"}})).data?.transactionAddStakeholder?.stakeholders?.find(i=>i.customer?.emailAddress===e.emailAddress);n?.customer&&this.assignCustomerInternal(n.customer)}assignCustomerInternal(e){this.getWorkflowManager().setTransactionCustomer(e);const t=wr.getMap("transactionCustomerIds")||new Map;t.set(this.getTransaction().id,e.id),wr.setMap("transactionCustomerIds",t)}attachRenderableSceneListener(e){this.renderableSceneCallbacks.push(e),e(this.renderableScenes)}detachRenderableSceneListener(e){this.renderableSceneCallbacks=this.renderableSceneCallbacks.filter(t=>t!==e)}async save(e){const t=this.getProduct(),n=this.getWorkflow(),i=this.getCommandContext().getState();if(!t)throw new an("Product undefined!");if(!n)throw new an("Workflow undefined!");if(!i)throw new an("State undefined!");const s={title:await(async()=>{if(e)return e;const o=this.getTransaction().id,u=(await eg.getSavedDesigns()).find(c=>c.transactionId===o)?.title;return u||"My design"})(),thumbnail:await this.createPreviewImage(!1,256),transactionId:this.getTransaction().id,productId:t.id,integrationProductId:this.getTransaction().integrationProduct.id,workflowName:n.name,workflowId:n.id,lastEdited:new Date};return await eg.addDesign(s),s}async copy(){const e=Ao(this.getCommandContext().getState());if(!e)throw new an("Internal state is undefined! Cannot copy experience!");const t=JSON.stringify(e.transaction),n=this.getWorkflow();if(!n)throw new an("Workflow is undefined! Cannot copy experience!");const i=this.getTransaction().integrationProduct?.id;if(!i)throw new an("Integration product id is undefined!");return await this.getClient().getWorkflowExperience({type:"integration",integrationProductId:i,workflowId:n.id,workflowState:t})}async onDesignFinished(e=!0){const t=this.getTransaction(),n=this.getProduct(),i=this.getWorkflow();if(!n)throw new an("Product undefined! Cannot finish an experience without a product.");if(!i)throw new an("Workflow undefined! Cannot finish an experience without a workflow.");if(t.isOrdered)return{event:"",exportedData:{},lineItemImageUrl:"",optionsCost:0,transactionId:t.id,workflowViewerLink:"",workflowViewerReadOnlyLink:""};const a=await JI([{workflowManager:this.workflowManager,workflow:i,layouts:this.workflowManager.getLayouts(),getReducerState:()=>this.workflowManager.getCommandContext().getState(),product:n,transaction:t,workflowSelections:this.workflowManager.getWorkflowSelections(),workflowMetadata:this.workflowManager.getWorkflowMetadata(),designName:i.name}],s=>e?this.createPreviewImage(s,1024):Promise.resolve(void 0));return t.completed&&await this.graphQlClient().mutate({mutation:cM,variables:{transactionId:t.id}}),a[0]}stepHasHandle(e){return e.type!==Ye.SilentIllustration&&e.type!==Ye.ProductOverlay}async getExportedStepData(){const e=this.getWorkflow(),t=this.getWorkflowManager().getWorkflowMetadata(),n=this.getWorkflowManager().getWorkflowSelections(),i=[];for(const a of e?.steps||[]){const s=a.stepName,o=t[s],l=n[s]?.selections[0],u={stepId:s,title:a.stepTitle,properties:[]};if(l&&await TV(a,n)&&u.properties.push({type:"selection",value:l.name,priceModifier:l.priceModifier}),!o){i.push(u);continue}switch(a.type){case Ye.Frame:{const c=a.data,f=o;f.image&&c.displayImageOnFinishStep&&u.properties.push({type:"image",value:f.image,priceModifier:0})}break;case Ye.Illustration:{const c=a.data,f=o;if(f&&f.colors&&f.colors.length>0&&c.displayColorsOnFinishStep){const d=f.colors.join(", ").toUpperCase();u.properties.push({type:"color",value:d,priceModifier:0})}}break;case Ye.Module:{const c=a.data,f=o;f&&f.text&&c.displayTextOnFinishStep&&u.properties.push({type:"text",value:f.text,priceModifier:0})}break;case Ye.Text:{const c=a.data,f=o;f&&f.text&&c.displayTextOnFinishStep&&u.properties.push({type:"text",value:f.text,priceModifier:0}),f&&f.color&&c.displayColorOnFinishStep&&u.properties.push({type:"color",value:f.color,priceModifier:0})}}i.push(u)}return i.filter(a=>a.properties&&a.properties.length>0)}getQuantity(){return this.getTransaction().quantity||1}async setQuantity(e){if(e<1)throw new RangeError("WorkflowExperience quantity must be greater than zero.");if(this.isReadOnly)throw new Error("Cannot update quantity on a read-only WorkflowExperience");this.getTransaction().quantity=e,this.callEvent("QuantityChanged"),this.checkForPriceBreakChanges();const t=this.getTransaction();await this.graphQlClient().mutate({mutation:tM,variables:{id:t.id,quantity:e}})}addEventListener(e,t){const n=this.eventCallbacks.get(e)||[];n.push(t),this.eventCallbacks.set(e,n)}removeEventListener(e,t){const n=this.eventCallbacks.get(e)||[];this.eventCallbacks.set(e,n.filter(i=>i!==t))}callEvent(e){(this.eventCallbacks.get(e)||[]).forEach(t=>t(this))}}const kV=r=>{if([Ye.Question,Ye.Frame,Ye.Illustration,Ye.Material,Ye.Model,Ye.Picture,Ye.Shape,Ye.Text].includes(r.type)){const t=r.data;return!!t.displaySelectionOnFinishStep||!!t.displaySelectionsOnFinishStep}return!1},TV=async(r,e)=>{if(!kV(r))return!1;const t=await ct.getOptionForStep(r);if(t&&(t.variants||[]).length>1){const n=e[r.stepName];return!!(n&&n.selections.length>0)}return!1};class FV{constructor(e){this.handleCache={},this.bundle=e}async getHandle(e){if(this.handleCache[e.name])return this.handleCache[e.name];const t=await this.createHandle(e);return this.handleCache[e.name]=t,t}async getHandles(){if(!this.bundle.getGlobalPropertyConfiguration())return[];await this.bundle.getGlobalPropertyStateManager().getInitializationPromise();const e=this.bundle.getGlobalPropertyConfiguration();return e?Promise.all(e.aspects.map(t=>this.getHandle(t))):[]}applyConditionsFromState(e,t){return t?e.filter(n=>this.aspectConditionsSatisfied(n.getRawProperty(),t)):e}aspectConditionsSatisfied(e,t){return!e.conditions||e.conditions.length===0?!0:(e.conditionMode===Wk.AND?Array.prototype.every.bind(e.conditions):Array.prototype.some.bind(e.conditions))(i=>{const a=t.aspects.find(s=>s.name===i.targetAspectName);return a?i.requiredVariantSelections.some(s=>s===a.value):!1})}async createHandle(e){switch(e.type){case Gn.FileUpload:return new KI(this.bundle,e).initialize();case Gn.ColorOption:return new CA(this.bundle,e,e.entityId?await ct.getOption(e.entityId):void 0);case Gn.Option:{const t=e.entityId?await ct.getOption(e.entityId):void 0;return t?.type==="Color"?new CA(this.bundle,e,t):new W1(this.bundle,e,t)}case Gn.Text:return new ZI(this.bundle,e);default:throw new Error("Unhandled Global Property Aspect Type")}}}class rm{constructor(e,t){this.bundle=e,this.property=t}getName(){return this.property.name}getTitle(){return this.property.title}getDescription(){return this.property.description}getType(){return this.property.type}getRawProperty(){return this.property}isMandatory(){return!!this.property.mandatory}isMandatoryFulfilled(){return!this.property.mandatory||!!this.bundle.getGlobalPropertyStateManager().getAspectMandatoryFulfilled(this.property.name)}isSilent(){return!!this.property.silent||this.bundle.getGlobalPropertyStateManager().getAspectHidden(this.property.name)}async getSharedSteps(e){const t=e??this.bundle.getWorkflowExperiences();return(await Promise.all(t.map(a=>a.getStepsConditionallyActive()))).map(a=>a.filter(s=>s.getOverrideGlobalPropertyConfiguration(this.property.type)?!1:s.getRaw().globalPropertyAspectConfigurations?.some(o=>o.globalPropertyConfigurationId===this.bundle.getGlobalPropertyConfiguration()?.id&&o.aspectName===this.property.name))).flat()}getStateValue(){return this.bundle.getGlobalPropertyStateManager().getAspect(this.property.name)}}class KI extends rm{constructor(e,t){super(e,t)}async initialize(){return this.property.data?.fileUpload?.colorOptionId&&(this.colorOption=await ct.getOption(this.property.data?.fileUpload?.colorOptionId)),await this.loadImageData(),this}async loadImageData(){const e=await this.getImage();if(e?.fileLink)if(bf(e.fileLink)==="svg"){const t=await ia(e?.fileLink),n=await B1(e?.fileLink),i=n.width,a=n.height,s=await Ra(t);this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)?.colors?.forEach(u=>{s.colors[u.key]={browserValue:u.browserValue,pmsValue:u.pmsValue}});const l={src:e?.fileLink,width:i,height:a,aspect:i/a,svg:s.svg,colors:s.colors};Os.set(e?.fileLink,l),this.imageData=l}else this.imageData=void 0}async selectImage(e){const t=this.bundle.getGlobalPropertyStateManager();await Promise.all([t.setAspect(this.property.name,e.key,{...t.getAspectStorage(this.property.name)||{},originalAssetKey:e.key,backgroundRemovedAssetKey:void 0,vectorizedAssetKey:void 0,useOriginalAsset:void 0},void 0),this.applyImageSelection(e),this.loadImageData()])}async canUseAdvancedImageManipulation(){return this.bundle.getClient().canUseAddon(Ug.AdvancedImageManipulation)}async removeBackgroundFromImage(e=!0){if(!await this.canUseAdvancedImageManipulation())throw new Error("The current Integration does not have access to the Advanced Image Manipulation addon. Please call canUseAdvancedImageManipulation to ensure you disable this feature when appropriate.");const t=await this.getOriginalImage();if(!t)throw new Error("You must supply an image selection before attempting to remove the background.");const n=this.bundle.getGlobalPropertyStateManager(),i=await Un.removeBackgroundFromAsset(t),s={...n.getAspectStorage(this.property.name),backgroundRemovedAssetKey:i.key,useOriginalAsset:!e},l=[e?n.setAspect(this.property.name,i.key,s):n.setAspectStorage(this.property.name,s)];return e&&(l.push(this.applyImageSelection(i,void 0,!1,!1)),l.push(this.loadImageData())),await Promise.all(l),this.updateSharedStepStorage(s),i}async vectorizeImage(e=!0){if(!await this.canUseAdvancedImageManipulation())throw new Error("The current Integration does not have access to the Advanced Image Manipulation addon. Please call canUseAdvancedImageManipulation to ensure you disable this feature when appropriate.");const t=await this.getOriginalImage();if(!t)throw new Error("You must supply an image selection before attempting to vectorize the image.");const n=this.bundle.getGlobalPropertyStateManager(),i=await Un.vectorizeAsset(t),s={...n.getAspectStorage(this.property.name),vectorizedAssetKey:i.key,useOriginalAsset:!e},l=[e?n.setAspect(this.property.name,i.key,s):n.setAspectStorage(this.property.name,s)];return e&&(l.push(this.applyImageSelection(i,void 0,!1,!1)),l.push(this.loadImageData())),await Promise.all(l),this.updateSharedStepStorage(s),i}hasImage(){return!!this.getStateValue()}async getImage(){const e=this.getStateValue();if(e)return Un.getLocalOrFromServer(e)}async getImageWithColors(){return await this.loadImageData(),this.imageData?.svg?Gg(qg(this.imageData.svg,this.imageData.colors??{},!1)):this.imageData?.src}async getOriginalImage(){const e=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);if(e?.originalAssetKey)return Un.getLocalOrFromServer(e.originalAssetKey)}async getBackgroundRemovedImage(){const e=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);if(e?.backgroundRemovedAssetKey)return Un.getLocalOrFromServer(e.backgroundRemovedAssetKey)}getUseOriginalImage(){return this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)?.useOriginalAsset??!1}async setUseOriginalImage(e){const t=await this.getOriginalImage();if(!t)throw new Error("You must select an image before calling setUseOriginalImage");const n=this.bundle.getGlobalPropertyStateManager(),i=n.getAspectStorage(this.property.name);if(i?.useOriginalAsset===e)return;const a={...i,useOriginalAsset:e},s=e?i?.originalAssetKey:i?.backgroundRemovedAssetKey,o=[n.setAspect(this.property.name,s||"",a)];if(e)o.push(this.applyImageSelection(t,void 0,!1,!1));else{const l=async()=>{const u=await this.getBackgroundRemovedImage();if(!u)throw new Error("You must call removeBackgroundFromImage before attempting to use that version of the image.");this.applyImageSelection(u,void 0,!1,!1)};o.push(l())}o.push(this.loadImageData()),await Promise.all(o),this.updateSharedStepStorage(a)}async applyGlobalState(e){const t=this.getStateValue();if(!t)return;const n=await Un.getLocalOrFromServer(t);if(!n)return;await this.applyImageSelection(n,e,!1,!0);const i=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);if(i){if(this.updateSharedStepStorage({...i}),i.colors){const a=new Map(i.colors.map(s=>[s.key,{browserValue:s.browserValue,pmsValue:s.pmsValue}])??[]);await Promise.all((await this.getSharedSteps(e)).map(async s=>{await s.changeColors(a)}))}}else this.updateSharedStepStorage({originalAssetKey:t}),await this.bundle.getGlobalPropertyStateManager().setAspectStorage(this.property.name,{originalAssetKey:t})}getAvailableColors(){return this.property.data?.fileUpload?.colorPickerEnabled?this.colorOption?.variants?.map(e=>({fill:e.color,stroke:e.color,variant:e,pmsValue:e.name}))??[]:[]}getCurrentColors(){return this.imageData?.colors}isColorPickerEnabled(){return this.property.data?.fileUpload?.colorPickerEnabled??!1}isPmsPickerEnabled(){return this.property.data?.fileUpload?.pmsPickerEnabled??!1}async getOriginalColors(){return this.imageData?.svg?(await Ra(this.imageData.svg)).colors:void 0}async changeColors(e){if(!this.imageData?.svg)return;const t=this.getSharedSteps(),n=new Map(Object.entries(e));await Promise.all((await t).map(async a=>{await a.changeColors(n)}));const i=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name);await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspectStorage(this.property.name,{...i,colors:Object.entries(e).map(([a,s])=>({key:a,browserValue:s.browserValue,pmsValue:s.pmsValue}))}),await this.loadImageData()])}async applyImageSelection(e,t,n=!0,i=!0){const s=(await this.getSharedSteps(t)).map(o=>{const l=o;if(l.getFrameService())return l.selectImage(e,n,i)});await Promise.all(s)}updateSharedStepStorage(e){this.bundle.getWorkflowExperiences().forEach(n=>n.getSteps().forEach(i=>{if(i.getOverrideGlobalPropertyConfiguration(this.property.type))return;i.getRaw().globalPropertyAspectConfigurations?.some(s=>s.globalPropertyConfigurationId===this.bundle.getGlobalPropertyConfiguration()?.id&&s.aspectName===this.property.name)&&n.getWorkflowManager().updateStorage(i.getId(),{framePatternData:{originalAssetKey:e.originalAssetKey,backgroundRemovedAssetKey:e.backgroundRemovedAssetKey,useOriginalAsset:e.useOriginalAsset}})}))}}class ZI extends rm{constructor(e,t){super(e,t)}isTemplatingEnabled(){return this.property.data?.text?.templatingEnabled||!1}getText(){const e=this.getStateValue();return e||""}async setText(e){await Promise.all([this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,e,void 0,void 0),this.applyTextSelection(e)])}async applyGlobalState(e){const t=this.getStateValue();if(!t)return Promise.resolve();await this.applyTextSelection(t,e)}async applyTextSelection(e,t){const i=(await this.getSharedSteps(t)).map(a=>{a.setText(e)});await Promise.all(i)}}class W1 extends rm{constructor(e,t,n){super(e,t),this.optionResource=n}async ensureOptionLoaded(){if(this.optionResource?.variants)return this.optionResource;if(!this.property.entityId)return this.optionResource;const e=await ct.getOption(this.property.entityId);return e&&(this.optionResource=e),this.optionResource}async initDefaultVariant(){await this.ensureOptionLoaded();const e=this.optionResource?.variants?.find(t=>t.id===this.optionResource?.defaultVariant?.id);e&&await this.selectVariant(new Pa(e))}getCurrentVariant(){if(!this.optionResource)return;const e=this.getStateValue();if(e){const t=this.optionResource.variants?.find(n=>n.id===e);return t?new Pa(t):void 0}else{const t=this.optionResource.variants?.find(n=>n.id===this.optionResource?.defaultVariant?.id);return t?new Pa(t):void 0}}async getAvailableVariants(){return await this.ensureOptionLoaded(),(this.optionResource?.variants?.filter(t=>t.enabled)||[]).map(t=>new Pa(t))}async getAllVariants(){return await this.ensureOptionLoaded(),(this.optionResource?.variants||[]).map(t=>new Pa(t))}async selectVariant(e,t){await this.applyVariantSelection(e),await this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,e.getId(),void 0,t)}async applyGlobalState(e){const t=this.getStateValue();if(!t)return;await this.ensureOptionLoaded();const n=this.optionResource?.variants?.find(i=>i.id===t);if(n)return this.applyVariantSelection(new Pa(n),e)}async applyVariantSelection(e,t){const i=(await this.getSharedSteps(t)).map(a=>a.selectVariant(e));await Promise.all(i)}}class CA extends W1{constructor(e,t,n){super(e,t,n)}async selectVariant(e,t){await this.bundle.getGlobalPropertyStateManager().setAspect(this.property.name,e.getId(),void 0,t),await this.applyColorVariant(e,void 0,t)}async applyGlobalState(e){const t=this.getStateValue();if(!t)return;await this.ensureOptionLoaded();const n=this.optionResource?.variants?.find(a=>a.id===t);if(!n)return;await this.applyColorVariant(new Pa(n),e);const i=this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)?.customColor;i&&await this.setCustomColor(i)}async applyColorVariant(e,t,n){const a=(await this.getSharedSteps(t)).map(s=>{switch(s.getType()){case Ye.Shape:return s.selectVariant(e);case Ye.Text:return s.setFillColor({fill:e.getColor(),stroke:e.getColor(),variant:e.getResource()});case Ye.Illustration:return s.setColor(n?.toString()||"",e.getColor()||"")}});await Promise.all(a)}async setCustomColor(e){const t=this.getCurrentVariant()?.getColor();t&&t.toLowerCase()==="#custom"&&(await this.getSharedSteps()).forEach(i=>i.setCustomColor(e)),this.bundle.getGlobalPropertyStateManager().setAspectStorage(this.property.name,{customColor:e})}getCustomColor(){return this.bundle.getGlobalPropertyStateManager().getAspectStorage(this.property.name)?.customColor||this.getCurrentVariant()?.getColor()||"#ffffff"}}const IV=(r,e,t)=>{const n=r.getWorkflowExperiences(),i=r.getGlobalPropertyConfiguration();return i?n.flatMap(s=>s.getSteps()).filter(s=>s.getGlobalPropertyAspects(i.id).includes(e)&&s.getType()===t):[]},eP=(r,e)=>{const n=IV(r,e,Ye.Illustration).map(i=>{if(!i.getCurrentVariant()?.getAssetResource()?.assetConfiguration)return 0;const s=i.getColors();return s?Object.getOwnPropertyNames(s).length:0});return Math.max(...n)};var Hd={exports:{}};Hd.exports;var $E;function PV(){return $E||($E=1,(function(r,e){var t=200,n="Expected a function",i="__lodash_hash_undefined__",a=500,s=1,o=2,l=4,u=800,c=16,f=9007199254740991,d="[object Arguments]",h="[object Array]",g="[object AsyncFunction]",y="[object Boolean]",v="[object Date]",A="[object Error]",x="[object Function]",S="[object GeneratorFunction]",F="[object Map]",E="[object Number]",R="[object Null]",O="[object Object]",W="[object Promise]",Y="[object Proxy]",ae="[object RegExp]",U="[object Set]",$="[object String]",z="[object Symbol]",Q="[object Undefined]",K="[object WeakMap]",le="[object ArrayBuffer]",he="[object DataView]",Me="[object Float32Array]",De="[object Float64Array]",Pe="[object Int8Array]",re="[object Int16Array]",ue="[object Int32Array]",$e="[object Uint8Array]",Je="[object Uint8ClampedArray]",Re="[object Uint16Array]",We="[object Uint32Array]",Ge=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,He=/^\w*$/,ze=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,bt=/[\\^$.*+?()[\]{}|]/g,rr=/\\(\\)?/g,Dr=/\w*$/,jt=/^\[object .+?Constructor\]$/,ar=/^(?:0|[1-9]\d*)$/,St={};St[Me]=St[De]=St[Pe]=St[re]=St[ue]=St[$e]=St[Je]=St[Re]=St[We]=!0,St[d]=St[h]=St[le]=St[y]=St[he]=St[v]=St[A]=St[x]=St[F]=St[E]=St[O]=St[ae]=St[U]=St[$]=St[K]=!1;var st={};st[d]=st[h]=st[le]=st[he]=st[y]=st[v]=st[Me]=st[De]=st[Pe]=st[re]=st[ue]=st[F]=st[E]=st[O]=st[ae]=st[U]=st[$]=st[z]=st[$e]=st[Je]=st[Re]=st[We]=!0,st[A]=st[x]=st[K]=!1;var Yr=typeof di=="object"&&di&&di.Object===Object&&di,Sr=typeof self=="object"&&self&&self.Object===Object&&self,gr=Yr||Sr||Function("return this")(),nr=e&&!e.nodeType&&e,dr=nr&&!0&&r&&!r.nodeType&&r,Yt=dr&&dr.exports===nr,Xt=Yt&&Yr.process,mt=(function(){try{var L=dr&&dr.require&&dr.require("util").types;return L||Xt&&Xt.binding&&Xt.binding("util")}catch{}})(),xr=mt&&mt.isMap,on=mt&&mt.isSet,_r=mt&&mt.isTypedArray;function ir(L,ne,oe){switch(oe.length){case 0:return L.call(ne);case 1:return L.call(ne,oe[0]);case 2:return L.call(ne,oe[0],oe[1]);case 3:return L.call(ne,oe[0],oe[1],oe[2])}return L.apply(ne,oe)}function Xr(L,ne){for(var oe=-1,Ue=L==null?0:L.length;++oe<Ue&&ne(L[oe],oe,L)!==!1;);return L}function kr(L,ne){for(var oe=-1,Ue=L==null?0:L.length,pt=0,Mt=[];++oe<Ue;){var Wr=L[oe];ne(Wr,oe,L)&&(Mt[pt++]=Wr)}return Mt}function en(L,ne){for(var oe=-1,Ue=L==null?0:L.length,pt=Array(Ue);++oe<Ue;)pt[oe]=ne(L[oe],oe,L);return pt}function Vr(L,ne){for(var oe=-1,Ue=ne.length,pt=L.length;++oe<Ue;)L[pt+oe]=ne[oe];return L}function gn(L,ne){for(var oe=-1,Ue=Array(L);++oe<L;)Ue[oe]=ne(oe);return Ue}function mn(L){return function(ne){return L(ne)}}function Tr(L,ne){return L?.[ne]}function $r(L,ne){return function(oe){return L(ne(oe))}}var tn=Array.prototype,zr=Function.prototype,Vt=Object.prototype,sr=gr["__core-js_shared__"],Er=zr.toString,tt=Vt.hasOwnProperty,Nr=(function(){var L=/[^.]+$/.exec(sr&&sr.keys&&sr.keys.IE_PROTO||"");return L?"Symbol(src)_1."+L:""})(),Jr=Vt.toString,Se=Er.call(Object),D=RegExp("^"+Er.call(tt).replace(bt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),V=Yt?gr.Buffer:void 0,Z=gr.Symbol,ce=gr.Uint8Array;V&&V.allocUnsafe;var ke=$r(Object.getPrototypeOf,Object),je=Vt.propertyIsEnumerable,wt=tn.splice,Dt=Z?Z.isConcatSpreadable:void 0,_t=Z?Z.toStringTag:void 0,or=(function(){try{var L=Lt(Object,"defineProperty");return L({},"",{}),L}catch{}})(),Nt=Object.getOwnPropertySymbols,ee=V?V.isBuffer:void 0,Te=Math.max,qe=Date.now,Qe=Lt(gr,"DataView"),Ct=Lt(gr,"Map"),ft=Lt(gr,"Promise"),Rt=Lt(gr,"Set"),Et=Lt(gr,"WeakMap"),hr=Lt(Object,"create"),tr=hi(Qe),fr=hi(Ct),$t=hi(ft),Mn=hi(Rt),Dn=hi(Et),mr=Z?Z.prototype:void 0,Cr=mr?mr.valueOf:void 0,xn=mr?mr.toString:void 0;function Rr(L){var ne=-1,oe=L==null?0:L.length;for(this.clear();++ne<oe;){var Ue=L[ne];this.set(Ue[0],Ue[1])}}function qn(){this.__data__=hr?hr(null):{},this.size=0}function Cn(L){var ne=this.has(L)&&delete this.__data__[L];return this.size-=ne?1:0,ne}function Hr(L){var ne=this.__data__;if(hr){var oe=ne[L];return oe===i?void 0:oe}return tt.call(ne,L)?ne[L]:void 0}function Sn(L){var ne=this.__data__;return hr?ne[L]!==void 0:tt.call(ne,L)}function dn(L,ne){var oe=this.__data__;return this.size+=this.has(L)?0:1,oe[L]=hr&&ne===void 0?i:ne,this}Rr.prototype.clear=qn,Rr.prototype.delete=Cn,Rr.prototype.get=Hr,Rr.prototype.has=Sn,Rr.prototype.set=dn;function rn(L){var ne=-1,oe=L==null?0:L.length;for(this.clear();++ne<oe;){var Ue=L[ne];this.set(Ue[0],Ue[1])}}function Jn(){this.__data__=[],this.size=0}function si(L){var ne=this.__data__,oe=Jt(ne,L);if(oe<0)return!1;var Ue=ne.length-1;return oe==Ue?ne.pop():wt.call(ne,oe,1),--this.size,!0}function En(L){var ne=this.__data__,oe=Jt(ne,L);return oe<0?void 0:ne[oe][1]}function yn(L){return Jt(this.__data__,L)>-1}function ln(L,ne){var oe=this.__data__,Ue=Jt(oe,L);return Ue<0?(++this.size,oe.push([L,ne])):oe[Ue][1]=ne,this}rn.prototype.clear=Jn,rn.prototype.delete=si,rn.prototype.get=En,rn.prototype.has=yn,rn.prototype.set=ln;function nn(L){var ne=-1,oe=L==null?0:L.length;for(this.clear();++ne<oe;){var Ue=L[ne];this.set(Ue[0],Ue[1])}}function Lr(){this.size=0,this.__data__={hash:new Rr,map:new(Ct||rn),string:new Rr}}function un(L){var ne=zt(this,L).delete(L);return this.size-=ne?1:0,ne}function k(L){return zt(this,L).get(L)}function B(L){return zt(this,L).has(L)}function G(L,ne){var oe=zt(this,L),Ue=oe.size;return oe.set(L,ne),this.size+=oe.size==Ue?0:1,this}nn.prototype.clear=Lr,nn.prototype.delete=un,nn.prototype.get=k,nn.prototype.has=B,nn.prototype.set=G;function X(L){var ne=this.__data__=new rn(L);this.size=ne.size}function pe(){this.__data__=new rn,this.size=0}function de(L){var ne=this.__data__,oe=ne.delete(L);return this.size=ne.size,oe}function xe(L){return this.__data__.get(L)}function Be(L){return this.__data__.has(L)}function rt(L,ne){var oe=this.__data__;if(oe instanceof rn){var Ue=oe.__data__;if(!Ct||Ue.length<t-1)return Ue.push([L,ne]),this.size=++oe.size,this;oe=this.__data__=new nn(Ue)}return oe.set(L,ne),this.size=oe.size,this}X.prototype.clear=pe,X.prototype.delete=de,X.prototype.get=xe,X.prototype.has=Be,X.prototype.set=rt;function ut(L,ne){var oe=Fi(L),Ue=!oe&&hs(L),pt=!oe&&!Ue&&ps(L),Mt=!oe&&!Ue&&!pt&&ve(L),Wr=oe||Ue||pt||Mt,Hn=Wr?gn(L.length,String):[],oi=Hn.length;for(var Hi in L)Wr&&(Hi=="length"||pt&&(Hi=="offset"||Hi=="parent")||Mt&&(Hi=="buffer"||Hi=="byteLength"||Hi=="byteOffset")||Xe(Hi,oi))||Hn.push(Hi);return Hn}function nt(L,ne,oe){var Ue=L[ne];(!(tt.call(L,ne)&&fs(Ue,oe))||oe===void 0&&!(ne in L))&&yr(L,ne,oe)}function Jt(L,ne){for(var oe=L.length;oe--;)if(fs(L[oe][0],ne))return oe;return-1}function yr(L,ne,oe){ne=="__proto__"&&or?or(L,ne,{configurable:!0,enumerable:!0,value:oe,writable:!0}):L[ne]=oe}function Gr(L,ne,oe,Ue,pt,Mt){var Wr;if(oe&&(Wr=pt?oe(L,Ue,pt,Mt):oe(L)),Wr!==void 0)return Wr;if(!ca(L))return L;var Hn=Fi(L);if(Hn)Wr=Ae(L);else{var oi=fe(L),Hi=oi==x||oi==S;if(ps(L))return Zn(L);if(oi==O||oi==d||Hi&&!pt)Wr={};else{if(!st[oi])return pt?L:{};Wr=Oe(L,oi)}}Mt||(Mt=new X);var Ul=Mt.get(L);if(Ul)return Ul;Mt.set(L,Wr),H(L)?L.forEach(function(da){Wr.add(Gr(da,ne,oe,da,L,Mt))}):T(L)&&L.forEach(function(da,Aa){Wr.set(Aa,Gr(da,ne,oe,Aa,L,Mt))});var Vl=lt,Uo=Hn?void 0:Vl(L);return Xr(Uo||L,function(da,Aa){Uo&&(Aa=da,da=L[Aa]),nt(Wr,Aa,Gr(da,ne,oe,Aa,L,Mt))}),Wr}function fn(L,ne,oe,Ue,pt){var Mt=-1,Wr=L.length;for(oe||(oe=Ke),pt||(pt=[]);++Mt<Wr;){var Hn=L[Mt];oe(Hn)?Vr(pt,Hn):pt[pt.length]=Hn}return pt}function Kn(L,ne){ne=kn(ne,L);for(var oe=0,Ue=ne.length;L!=null&&oe<Ue;)L=L[Ji(ne[oe++])];return oe&&oe==Ue?L:void 0}function $n(L,ne,oe){var Ue=ne(L);return Fi(L)?Ue:Vr(Ue,oe(L))}function vn(L){return L==null?L===void 0?Q:R:_t&&_t in Object(L)?Br(L):jr(L)}function Or(L){return zi(L)&&vn(L)==d}function Wn(L){return zi(L)&&fe(L)==F}function _n(L){if(!ca(L)||pr(L))return!1;var ne=gs(L)?D:jt;return ne.test(hi(L))}function Nn(L){return zi(L)&&fe(L)==U}function Oi(L){return zi(L)&&ms(L.length)&&!!St[vn(L)]}function wi(L){if(!ca(L))return Fr(L);var ne=vr(L),oe=[];for(var Ue in L)Ue=="constructor"&&(ne||!tt.call(L,Ue))||oe.push(Ue);return oe}var xi=or?function(L,ne){return or(L,"toString",{configurable:!0,enumerable:!1,value:Bt(ne),writable:!0})}:Kt;function Ln(L,ne,oe){var Ue=-1,pt=L.length;ne<0&&(ne=-ne>pt?0:pt+ne),oe=oe>pt?pt:oe,oe<0&&(oe+=pt),pt=ne>oe?0:oe-ne>>>0,ne>>>=0;for(var Mt=Array(pt);++Ue<pt;)Mt[Ue]=L[Ue+ne];return Mt}function Ti(L){if(typeof L=="string")return L;if(Fi(L))return en(L,Ti)+"";if(J(L))return xn?xn.call(L):"";var ne=L+"";return ne=="0"&&1/L==-1/0?"-0":ne}function zn(L,ne){ne=kn(ne,L);var oe=-1,Ue=ne.length;if(!Ue)return!0;for(;++oe<Ue;){var pt=Ji(ne[oe]);if(pt==="__proto__"&&!tt.call(L,"__proto__")||(pt==="constructor"||pt==="prototype")&&oe<Ue-1)return!1}var Mt=Yi(L,ne);return Mt==null||delete Mt[Ji(za(ne))]}function kn(L,ne){return Fi(L)?L:vt(L,ne)?[L]:Qn(ye(L))}function Zn(L,ne){return L.slice()}function lr(L){var ne=new L.constructor(L.byteLength);return new ce(ne).set(new ce(L)),ne}function Rn(L,ne){var oe=lr(L.buffer);return new L.constructor(oe,L.byteOffset,L.byteLength)}function Ci(L){var ne=new L.constructor(L.source,Dr.exec(L));return ne.lastIndex=L.lastIndex,ne}function I(L){return Cr?Object(Cr.call(L)):{}}function j(L,ne){var oe=lr(L.buffer);return new L.constructor(oe,L.byteOffset,L.length)}function se(L,ne,oe,Ue){var pt=!oe;oe||(oe={});for(var Mt=-1,Wr=ne.length;++Mt<Wr;){var Hn=ne[Mt],oi=void 0;oi===void 0&&(oi=L[Hn]),pt?yr(oe,Hn,oi):nt(oe,Hn,oi)}return oe}function we(L){return _(L)?void 0:L}function ht(L){return la(An(L,void 0,$a),L+"")}function lt(L){return $n(L,Ee,te)}function zt(L,ne){var oe=L.__data__;return Ot(ne)?oe[typeof ne=="string"?"string":"hash"]:oe.map}function Lt(L,ne){var oe=Tr(L,ne);return _n(oe)?oe:void 0}function Br(L){var ne=tt.call(L,_t),oe=L[_t];try{L[_t]=void 0;var Ue=!0}catch{}var pt=Jr.call(L);return Ue&&(ne?L[_t]=oe:delete L[_t]),pt}var M=Nt?function(L){return L==null?[]:(L=Object(L),kr(Nt(L),function(ne){return je.call(L,ne)}))}:qt,te=Nt?function(L){for(var ne=[];L;)Vr(ne,M(L)),L=ke(L);return ne}:qt,fe=vn;(Qe&&fe(new Qe(new ArrayBuffer(1)))!=he||Ct&&fe(new Ct)!=F||ft&&fe(ft.resolve())!=W||Rt&&fe(new Rt)!=U||Et&&fe(new Et)!=K)&&(fe=function(L){var ne=vn(L),oe=ne==O?L.constructor:void 0,Ue=oe?hi(oe):"";if(Ue)switch(Ue){case tr:return he;case fr:return F;case $t:return W;case Mn:return U;case Dn:return K}return ne});function Ae(L){var ne=L.length,oe=new L.constructor(ne);return ne&&typeof L[0]=="string"&&tt.call(L,"index")&&(oe.index=L.index,oe.input=L.input),oe}function Oe(L,ne,oe){var Ue=L.constructor;switch(ne){case le:return lr(L);case y:case v:return new Ue(+L);case he:return Rn(L);case Me:case De:case Pe:case re:case ue:case $e:case Je:case Re:case We:return j(L);case F:return new Ue;case E:case $:return new Ue(L);case ae:return Ci(L);case U:return new Ue;case z:return I(L)}}function Ke(L){return Fi(L)||hs(L)||!!(Dt&&L&&L[Dt])}function Xe(L,ne){var oe=typeof L;return ne=ne??f,!!ne&&(oe=="number"||oe!="symbol"&&ar.test(L))&&L>-1&&L%1==0&&L<ne}function vt(L,ne){if(Fi(L))return!1;var oe=typeof L;return oe=="number"||oe=="symbol"||oe=="boolean"||L==null||J(L)?!0:He.test(L)||!Ge.test(L)||ne!=null&&L in Object(ne)}function Ot(L){var ne=typeof L;return ne=="string"||ne=="number"||ne=="symbol"||ne=="boolean"?L!=="__proto__":L===null}function pr(L){return!!Nr&&Nr in L}function vr(L){var ne=L&&L.constructor,oe=typeof ne=="function"&&ne.prototype||Vt;return L===oe}function ur(L){var ne=ua(L,function(Ue){return oe.size===a&&oe.clear(),Ue}),oe=ne.cache;return ne}function Fr(L){var ne=[];if(L!=null)for(var oe in Object(L))ne.push(oe);return ne}function jr(L){return Jr.call(L)}function An(L,ne,oe){return ne=Te(ne===void 0?L.length-1:ne,0),function(){for(var Ue=arguments,pt=-1,Mt=Te(Ue.length-ne,0),Wr=Array(Mt);++pt<Mt;)Wr[pt]=Ue[ne+pt];pt=-1;for(var Hn=Array(ne+1);++pt<ne;)Hn[pt]=Ue[pt];return Hn[ne]=oe(Wr),ir(L,this,Hn)}}function Yi(L,ne){return ne.length<2?L:Kn(L,Ln(ne,0,-1))}var la=Xi(xi);function Xi(L){var ne=0,oe=0;return function(){var Ue=qe(),pt=c-(Ue-oe);if(oe=Ue,pt>0){if(++ne>=u)return arguments[0]}else ne=0;return L.apply(void 0,arguments)}}var Qn=ur(function(L){var ne=[];return L.charCodeAt(0)===46&&ne.push(""),L.replace(ze,function(oe,Ue,pt,Mt){ne.push(pt?Mt.replace(rr,"$1"):Ue||oe)}),ne});function Ji(L){if(typeof L=="string"||J(L))return L;var ne=L+"";return ne=="0"&&1/L==-1/0?"-0":ne}function hi(L){if(L!=null){try{return Er.call(L)}catch{}try{return L+""}catch{}}return""}function $a(L){var ne=L==null?0:L.length;return ne?fn(L):[]}function za(L){var ne=L==null?0:L.length;return ne?L[ne-1]:void 0}function ua(L,ne){if(typeof L!="function"||ne!=null&&typeof ne!="function")throw new TypeError(n);var oe=function(){var Ue=arguments,pt=ne?ne.apply(this,Ue):Ue[0],Mt=oe.cache;if(Mt.has(pt))return Mt.get(pt);var Wr=L.apply(this,Ue);return oe.cache=Mt.set(pt,Wr)||Mt,Wr};return oe.cache=new(ua.Cache||nn),oe}ua.Cache=nn;function fs(L,ne){return L===ne||L!==L&&ne!==ne}var hs=Or((function(){return arguments})())?Or:function(L){return zi(L)&&tt.call(L,"callee")&&!je.call(L,"callee")},Fi=Array.isArray;function Ha(L){return L!=null&&ms(L.length)&&!gs(L)}var ps=ee||qr;function gs(L){if(!ca(L))return!1;var ne=vn(L);return ne==x||ne==S||ne==g||ne==Y}function ms(L){return typeof L=="number"&&L>-1&&L%1==0&&L<=f}function ca(L){var ne=typeof L;return L!=null&&(ne=="object"||ne=="function")}function zi(L){return L!=null&&typeof L=="object"}var T=xr?mn(xr):Wn;function _(L){if(!zi(L)||vn(L)!=O)return!1;var ne=ke(L);if(ne===null)return!0;var oe=tt.call(ne,"constructor")&&ne.constructor;return typeof oe=="function"&&oe instanceof oe&&Er.call(oe)==Se}var H=on?mn(on):Nn;function J(L){return typeof L=="symbol"||zi(L)&&vn(L)==z}var ve=_r?mn(_r):Oi;function ye(L){return L==null?"":Ti(L)}function Ee(L){return Ha(L)?ut(L):wi(L)}var Ve=ht(function(L,ne){var oe={};if(L==null)return oe;var Ue=!1;ne=en(ne,function(Mt){return Mt=kn(Mt,L),Ue||(Ue=Mt.length>1),Mt}),se(L,lt(L),oe),Ue&&(oe=Gr(oe,s|o|l,we));for(var pt=ne.length;pt--;)zn(oe,ne[pt]);return oe});function Bt(L){return function(){return L}}function Kt(L){return L}function qt(){return[]}function qr(){return!1}r.exports=Ve})(Hd,Hd.exports)),Hd.exports}var DV=PV();const RV=Us(DV);function SA(r,e){function t(n){if(typeof n>"u"||!Array.isArray(n)&&!BV(n))return n;if(Array.isArray(n))return SA(n,e);let i={};for(const[a,s]of Object.entries(n))i[a]=OV(s)?s:SA(s,e);return RV(i,e)}return Array.isArray(r)?r.map(t):t(r)}function OV(r){return r==null}function BV(r){return typeof r=="object"&&!Array.isArray(r)&&r!==null}function zE(r,e){return r==null&&e==null?!0:r===e}function tP(r){const e=new Map;return r?.aspects?.forEach(t=>{t.value!==""&&e.set(t.name,!0)}),e}class MV extends Yg{constructor(e){super(),this.update=e}async execute(){await this.update(),await new Promise(e=>{window.setTimeout(()=>{e()},1e3)})}}function Ny(r){return SA(r,["__typename"])}class _V{constructor(e,t,n,i,a){this.stateUpdateQueue=new Xg(1),this.mandatoryFulfilledAspects=new Map,this.bundleId=e,this.bundleOwnerId=t,this.configuration=n,this.bundleOptions=a;const s=a?.existingGlobalPropertyState;this.initPromise=s?Promise.resolve(s).then(()=>{console.log("Setting global property state to existing state."),this.globalPropertyState=Ny(s),this.recalculateMandatoryStates()}):this.createGlobalPropertyState().then(o=>{console.log("Setting global property state to new state."),this.globalPropertyState=Ny(o),this.recalculateMandatoryStates()}),this.onGlobalPropertyStateChange=i}async clearAspects(e){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const t=this.globalPropertyState.aspects;this.globalPropertyState.aspects=t.filter(n=>!e.includes(n.name))}recalculateMandatoryStates(){this.mandatoryFulfilledAspects=tP(this.globalPropertyState)}setBundleOptions(e){this.bundleOptions=e}getBundleOptions(){return this.bundleOptions}setConfiguration(e){this.configuration=e}getInitializationPromise(){return this.initPromise}getGlobalPropertyState(){return this.globalPropertyState}async setGlobalPropertyState(e){this.globalPropertyState||await this.initPromise;const t=Ao(this.globalPropertyState);this.globalPropertyState={...Ny(e),id:t.id},this.recalculateMandatoryStates(),this.queueGlobalPropertyStateUpdate(),await this.onGlobalPropertyStateChange(t,this.globalPropertyState)}getAspectMandatoryFulfilled(e){return this.mandatoryFulfilledAspects.get(e)}getAspectHidden(e){if(!this.globalPropertyState)throw new Error("Global property state not initialized");return!!this.globalPropertyState.aspects.find(t=>t.name===e)?.hidden}getAspect(e,t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");const n=this.globalPropertyState.aspects.find(i=>i.name===e&&zE(i.channel,t));if(n)return n.value}getAspectStorage(e,t){if(!this.globalPropertyState)throw new Error("Global property state not initialized");return this.globalPropertyState.aspects.find(n=>n.name===e&&zE(n.channel,t))?.storage}async setAspect(e,t,n,i,a){if(!this.globalPropertyState)throw new Error("Global property state not initialized");if(!this.configuration)throw new Error("Global property configuration not linked to the state manager.");const s=this.configuration.aspects.find(u=>u.name===e);if(!s)throw new Error(`Failed to find configuration aspect with name: ${e}`);this.mandatoryFulfilledAspects.set(e,t!=="");const o=Ao(this.globalPropertyState),l=this.globalPropertyState.aspects.filter(u=>u.name===e);if(l.length>0)if(i){const u=l.find(c=>c.channel===i);if(u)u.value=t,u.type=s.type,u.channel=i,u.hidden=a??u.hidden,n!==void 0&&(u.storage=n!==null?n:void 0);else{let c;if(i===1){const f=this.globalPropertyState.aspects.findIndex(d=>!d.channel&&d.name===e);f&&f>0&&(c=this.globalPropertyState.aspects.splice(f,1)[0].hidden)}this.globalPropertyState.aspects.push({name:e,value:t,type:s.type,storage:n!==null?n:void 0,channel:i,hidden:a??c})}}else{const u=l[0];u.value=t,u.type=s.type,u.hidden=a??u.hidden,n!==void 0&&(u.storage=n!==null?n:void 0)}else this.globalPropertyState.aspects.push({name:e,value:t,type:s.type,storage:n!==null?n:void 0,channel:i,hidden:a});wf(o,this.globalPropertyState)||(this.queueGlobalPropertyStateUpdate(),await this.onGlobalPropertyStateChange(o,this.globalPropertyState))}async setAspectStorage(e,t,n){if(!this.globalPropertyState)throw new Error("Global property state not initialized");if(!this.configuration)throw new Error("Global property configuration not linked to the state manager.");const i=this.configuration.aspects.find(o=>o.name===e);if(!i)throw new Error(`Failed to find configuration aspect with name: ${e}`);const a=Ao(this.globalPropertyState),s=this.globalPropertyState.aspects.filter(o=>o.name===e);if(s.length>0)if(n){const o=s.find(l=>l.channel===n);o&&(o.storage=t!==null?t:void 0,o.type=i.type)}else{const o=s[0];o.storage=t!==null?t:void 0,o.type=i.type}else this.globalPropertyState.aspects.push({name:e,value:"",type:i.type,storage:t!==null?t:void 0,channel:n});wf(a,this.globalPropertyState)||(this.queueGlobalPropertyStateUpdate(),await this.onGlobalPropertyStateChange(a,this.globalPropertyState))}queueGlobalPropertyStateUpdate(){this.stateUpdateQueue.enqueue(new MV(async()=>{await this.updateGlobalPropertyState()}))}async updateGlobalPropertyState(){if(!this.globalPropertyState)throw new Error("Global property state not initialized");if(!(await Le.getShadowGraphqlClient().mutate({mutation:k9,variables:{id:this.globalPropertyState.id,aspects:this.globalPropertyState.aspects.map(t=>{let n=t.type&&t.storage?{}:void 0;if(n)switch(t.type){case Gn.FileUpload:{n.fileUpload=t.storage;break}case Gn.ColorOption:case Gn.Option:{n.option=t.storage;break}}return{name:t.name,value:t.value,type:t.type,storage:n,channel:t.channel,hidden:t.hidden}})},context:{headers:{bundleOwnerId:this.bundleOwnerId,...this.bundleOptions?.additionalHeaders}}})).data?.globalPropertyStateUpdate)throw new Error("Unable to update global property state")}async createGlobalPropertyState(){const e=await Le.getShadowGraphqlClient().mutate({mutation:E9,variables:{bundleId:this.bundleId},context:{headers:{bundleOwnerId:this.bundleOwnerId,...this.bundleOptions?.additionalHeaders}}});if(e.data?.globalPropertyStateCreate&&e.data.globalPropertyStateCreate.id)return e.data.globalPropertyStateCreate;throw new Error(`Unable to create global property state for bundle: ${this.bundleId}`)}}class NV{constructor(e){this.setState(e||'{"transactions": []}')}setState(e){e&&(this.state=JSON.parse(e))}getState(){return this.state}removeStateForTransaction(e){if(!this.state||!this.state.transactions)return;const t=this.state.transactions.findIndex(n=>n.transactionId===e);t!==-1&&this.state.transactions.splice(t,1)}getSerializedState(){if(this.state)return this.deleteFieldNameFromObjectRecursive(this.state,"__typename"),JSON.stringify(this.state)}deleteFieldNameFromObjectRecursive(e,t){if(!(typeof e!="object"||e===null))for(const n in e)n===t?delete e[n]:this.deleteFieldNameFromObjectRecursive(e[n],t)}}const LV=Ce`
|
|
2842
2845
|
query GetManyMetafields($entityIds: [String!]!) {
|
|
2843
2846
|
metafieldsMany(entityIds: $entityIds) {
|
|
2844
2847
|
id
|
|
@@ -2850,14 +2853,14 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2850
2853
|
}
|
|
2851
2854
|
}
|
|
2852
2855
|
}
|
|
2853
|
-
`;class
|
|
2856
|
+
`;class UV{constructor(){this.internalMap=new Map}async requestKeysForEntity(e,t){const n=new Map;return await this.ensureIdsArePresent([e]),t.forEach(i=>{const a=this.requestKeyForEntityIfAvailable(e,i);a&&n.set(i,a)}),n}async ensureIdsArePresent(e){if(e.every(n=>this.internalMap.has(n)))return;const t=await Le.getShadowGraphqlClient().query({query:LV,errorPolicy:"all",variables:{entityIds:e.filter(n=>!this.internalMap.has(n))}});e.forEach((n,i)=>{const a=t.data.metafieldsMany[i];this.internalMap.set(n,a.map(s=>({key:s.metafieldConfiguration.name,value:s.value,metafieldConfigurationId:s.metafieldConfiguration.id,metafieldType:s.metafieldConfiguration.metafieldType})))})}async requestKeyForEntity(e,t){if(!this.internalMap.has(e))return;let n=this.internalMap.get(e);const i=n.find(a=>a.key===t);return i||(await this.ensureIdsArePresent([e]),n=this.internalMap.get(e)),i?JSON.parse(i.value):void 0}requestKeyForEntityIfAvailable(e,t){if(!this.internalMap.has(e))return;const i=this.internalMap.get(e).find(a=>a.key===t);if(i)return JSON.parse(i.value)}requestIfAvailable(e,t){return this.internalMap.has(e)?this.internalMap.get(e).find(a=>a.metafieldConfigurationId===t):void 0}}const Sg=new UV;var rP=(r=>(r.Default="Default",r.Name="Name",r.Price="Price",r))(rP||{});class Q1{constructor(e){this.fullFetched=!1,this.collection=e;const t=this.collection.productCollectionProducts;t&&t.length>=this.collection.total&&(this.fullFetched=!0)}getId(){return this.collection.id}getName(){return this.collection.name}getDescription(){return this.collection.description||""}getDispatchStartDate(){if(this.collection.dispatchStartDate)return new Date(this.collection.dispatchStartDate)}getDispatchEndDate(){if(this.collection.dispatchEndDate)return new Date(this.collection.dispatchEndDate)}getImage(){return this.collection.image}getProducts(){if(!this.collection.productCollectionProducts)throw new Error("Failed to find products on collection. Ensure you fetch them first!");return this.collection.productCollectionProducts.filter(e=>!!e.product).map(e=>new Ou(e))}async fetchProducts(e){if(this.fullFetched)return(this.collection.productCollectionProducts??[]).filter(i=>!!i.product).map(i=>new Ou(i));const t=await Le.getShadowGraphqlClient().query({query:ME,variables:{id:this.getId(),productIds:e},errorPolicy:"all"}),n=this.collection.productCollectionProducts||[];return this.collection.productCollectionProducts=[...n,...t.data.productCollections[0].productCollectionProducts?.filter(i=>!n.some(a=>i.id===a.id))||[]],this.collection.productCollectionProducts.length>=this.collection.total&&(this.fullFetched=!0),this.collection.productCollectionProducts.filter(i=>!!i.product&&(!e||e.includes(i.product.id))).map(i=>new Ou(i))}async fetchProductsFeed(e,t,n,i,a,s,o,l){const u={id:this.getId(),productFilters:n?{link:"And",metafields:n}:void 0,productWorkflowFilters:l?{link:"And",metafields:l}:void 0,tags:i?{include:i.include??[],exclude:i.exclude??[]}:void 0,sortKey:a,sortDescending:s,quickSearch:o};if(this.fullFetched){const h=await Le.getShadowGraphqlClient().query({query:B9,errorPolicy:"all",variables:u});if(!h.data?.productCollections||h.data?.productCollections.length===0)throw new Error("Failed to filter product collection products.");const g=this.getProducts(),y=new Map;for(const A of g)y.set(A.getId(),A);const v=h.data.productCollections[0].productCollectionProductsFeed.items.map(A=>y.get(A.product.id)).filter(A=>!!A);return{total:v.length,items:v.slice(e,e+t)}}const c=new AbortController,{signal:f}=c,d=Le.getShadowGraphqlClient().watchQuery({query:M9,variables:{...u,limit:t,offset:e},errorPolicy:"all",fetchPolicy:"cache-first",returnPartialData:!0,context:{fetchOptions:{signal:f}}});return new Promise(h=>{let g=!1;const y=d.subscribe({next(v){if(g||v.partial&&(!v.data.productCollections||v.data.productCollections.length===0||!v.data.productCollections[0].productCollectionProductsFeed?.items||v.data.productCollections[0].productCollectionProductsFeed?.items.length===0))return;c.abort(),g=!0,y.unsubscribe();const A=v.data.productCollections?.[0].productCollectionProductsFeed?.items.filter(x=>!!x.product).map(x=>new Ou(Ao(x)))||[];h({items:A,total:v.data.productCollections?.[0].productCollectionProductsFeed?.total??0})},error(){g||(g=!0,y.unsubscribe(),h({items:[],total:0}))}})})}async fetchProductsById(e){const t=await Le.getShadowGraphqlClient().query({query:ME,variables:{collectionId:this.collection.id,productIds:e},errorPolicy:"all"});if(t.data?.productCollection?.productCollectionProducts)return t.data.productCollection.productCollectionProducts.map(n=>new Ou(n))}getResource(){return this.collection}}class Ou{constructor(e){this.product=e.product,this.collectionProductResource=e}getId(){return this.product.id}getName(){return this.product.name}getIntegrationByType(e,t){const i=(this.product.integrationProducts||[]).find(a=>{const s=a.integration?.type,o=a.integration?.type===e,l=t?a.integration?.externalIntegrationId===t:!0;return s&&o&&l});if(!i)throw new Error("Failed to find requested integration type on product. This is generally due to a configuration error");return i}getCurrentIntegration(){const t=(this.product.integrationProducts||[]).find(n=>n.integration?.isCurrent);if(!t)throw new Error(`Product: ${this.collectionProductResource.id} is not linked to this current integration. This is generally due to a configuration error.`);return t}getDefaultWorkflow(){const e=this.product.workflows;if(e===void 0)throw new fo("Called getDefaultWorkflow() before fetching collection products. Use collection.fetchProducts() first to ensure the data is available.");if(e.length===0)throw new fo("Called getDefaultWorkflow() but no workflows on requested product. Ensure at least 1 workflow is assigned to this product.");const t=this.collectionProductResource.workflowId;if(t){const n=e.find(i=>i.workflowName===t);if(n)return new co(n)}if(this.collectionProductResource.workflows){if(this.collectionProductResource.workflows.length===1)return new co(this.collectionProductResource.workflows[0].workflowProduct)}else if(e.length===1)return new co(e[0]);throw new fo("Called getDefaultWorkflow() but no default workflow is configured for the requested product. Multiple workflows exist so we can't assume!")}getAllWorkflows(){if((this.product.workflows||[]).length===0)throw new fo("No workflows on configured product. Ensure at least 1 workflow is assigned to this product.");return this.collectionProductResource.workflows&&this.collectionProductResource.workflows.length>0?this.collectionProductResource.workflows.map(t=>new co(t.workflowProduct)):this.product.workflows.sort((t,n)=>(t.index??0)-(n.index??0)).map(t=>new co(t))}getIntegrations(){return this.product.integrationProducts||[]}getResource(){return this.product}getBasePrice(e){const t=this.product.basePrice||0;if(!e)return t;if(!e.integrationType&&!e.externalId&&!e.integrationId)throw new Error("You must provide at least one of the following fields on the includeAdditionalProduct object: integrationType, externalId, integrationId");let n;return e.integrationId?n=this.product.integrationProducts?.find(i=>i.integration?.id===e.integrationId):e.externalId?n=this.product.integrationProducts?.find(i=>i.integration?.externalIntegrationId===e.externalId):n=this.product.integrationProducts?.find(i=>i.integration?.type===e.integrationType),n?.additionalIntegrationProduct?.product?t+(n.additionalIntegrationProduct.product.basePrice||0):t}async requestMetafields(e){return Sg.requestKeysForEntity(this.product.id,e)}}class co{constructor(e){this.workflow=e}getId(){return this.workflow.workflowName}getName(){return this.workflow.friendlyName}getThumbnail(e=128,t){const n=this.workflow?.imageUrl,i=window?.devicePixelRatio||1;if(n)return Wg(n,e*i,"webp",t)}}const VV=Ce`
|
|
2854
2857
|
${tm(!1)}
|
|
2855
2858
|
query GetProductCollections($ids: [String!]!) {
|
|
2856
2859
|
productCollections(ids: $ids) {
|
|
2857
2860
|
...ProductCollectionFields
|
|
2858
2861
|
}
|
|
2859
2862
|
}
|
|
2860
|
-
|
|
2863
|
+
`,$V=async r=>(await Le.getShadowGraphqlClient().query({query:VV,errorPolicy:"all",variables:{ids:r}})).data?.productCollections?.map(t=>new Q1(t));class zV{constructor(){this.listeners={}}on(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}off(e,t){this.listeners[e]&&(this.listeners[e]=this.listeners[e].filter(n=>n!==t))}emit(e,t){if(this.listeners[e])for(const n of this.listeners[e])n(t)}clear(e){if(e)delete this.listeners[e];else for(const t in this.listeners)delete this.listeners[t]}}const HV=Ce`
|
|
2861
2864
|
mutation AddAddressToBundle(
|
|
2862
2865
|
$bundleId: String!
|
|
2863
2866
|
$streetAddress: String
|
|
@@ -2879,26 +2882,26 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2879
2882
|
id
|
|
2880
2883
|
}
|
|
2881
2884
|
}
|
|
2882
|
-
`,
|
|
2885
|
+
`,GV=Ce`
|
|
2883
2886
|
mutation AddOrganizationToBundle($bundleId: String!, $organizationName: String!) {
|
|
2884
2887
|
organizationAttachToBundle(bundleId: $bundleId, organizationName: $organizationName) {
|
|
2885
2888
|
id
|
|
2886
2889
|
}
|
|
2887
2890
|
}
|
|
2888
|
-
`,
|
|
2891
|
+
`,jV=Ce`
|
|
2889
2892
|
mutation GenerateQuoteId($id: String!) {
|
|
2890
2893
|
bundleGenerateQuoteId(id: $id) {
|
|
2891
2894
|
id
|
|
2892
2895
|
quoteId
|
|
2893
2896
|
}
|
|
2894
2897
|
}
|
|
2895
|
-
`;class HE{constructor(e,t,n,i,a,s,o){this.workflowExperiences=[],this.eventEmitter=new $V,this.updatesLocked=!1,this.client=e,this.id=t.id,this.name=t.name||"",this.dispatchDate=t.dispatchDate,this.purchaseOrder=t.purchaseOrder,this.template=t.template||!1,this.test=t.test||!1,this.quoteId=t.quoteId,this.shareActions=t.bundleShareActions,this.workflowViewerLink=t.workflowViewerLink,this.workflowViewerAmendLink=t.workflowViewerAmendLink,this.ownerId=a,this.metadata=new Map(t.metadata?.map(l=>[l.key,l.value])||[]),this.completed=t.completed??!1,this.productCollection=t.productCollection,this.activation=t.activation,this.bundleStateManager=new _V(t.bundleStateData),this.originalGlobalPropertyConfiguration=t.globalPropertyConfiguration,this.globalPropertyStateManager=new MV(this.id,this.ownerId,this.getGlobalPropertyConfiguration(),this.onGlobalPropertiesChanged.bind(this),s),this.globalPropertyHandleService=new TV(this),this.setPreviewService(n),this.initializationPromise=(async()=>{if(!s?.readonly){const l=this.bundleStateManager.getState();if(l.integrationProductIds&&l.integrationProductIds.length>0){const u=await Le.getShadowGraphqlClient().query({query:PT,variables:{ids:l.integrationProductIds},errorPolicy:"all",fetchPolicy:"no-cache"});if(u.errors)throw new Error(`Failed to fetch integration products for Bundle ${t.id}`);const c=u.data.integrationProducts?.filter(d=>!!d.product?.id&&l.integrationProductIds.includes(d.id)).map(d=>d.product.id);l.integrationProductIds=[],l.productIds=Array.from(new Set([...l.productIds||[],...c||[]]));const f=JSON.stringify(l);this.bundleStateManager.setState(f),await Le.getShadowGraphqlClient().mutate({mutation:Tp,variables:{id:this.id,bundleStateData:f},context:{bundleOwnerId:a}})}}return Promise.all([this.loadExistingWorkflowExperiences(t.transactionIds||[],{...i,bundleOwnerId:a},o),this.globalPropertyStateManager.getInitializationPromise()]).then(()=>new Promise((l,u)=>{if(s?.readonly){l([]);return}console.log("Setting default global variants."),this.initializeUninitializedHandles().then(l).catch(u)}))})(),this.initializationPromise.catch(l=>{console.error(`Bundle initialization failed: ${l}`)}),this.initializationPromise.then(()=>{this.getGlobalProperties().then(l=>this.checkMandatoryHandlesChanged(void 0,l))})}async initializeUninitializedHandles(){const e=this.globalPropertyStateManager.getGlobalPropertyState();if(!e)return console.log("Attempted to set global default variant before state was initialized."),[];const n=(await this.globalPropertyHandleService.getHandles()).map(async i=>{if(i.getType()===Gn.ColorOption||i.getType()===Gn.Option){const a=i;if(!e.aspects.find(o=>o.name===a.getName()))try{return await a.initDefaultVariant()}catch(o){console.error(`Failed to initialize default global variant - ${o}`)}}});return Promise.all(n)}getProductIds(){return this.bundleStateManager.getState()?.productIds}async addProductId(e){const t=this.bundleStateManager.getState();if(t){if(!t.productIds)t.productIds=[];else if(t.productIds.some(i=>i===e)){this.fireEvent("bundle-products-added",{productIds:t.productIds,added:[]});return}t.productIds=[...t.productIds,e];const n=JSON.stringify(t);this.bundleStateManager.setState(n),this.fireEvent("bundle-products-added",{productIds:t.productIds,added:[e]}),await Le.getShadowGraphqlClient().mutate({mutation:Tp,variables:{id:this.id,bundleStateData:n},context:{bundleOwnerId:this.ownerId}})}}async removeProductIds(e){const t=this.bundleStateManager.getState();if(t){const n=e.filter(a=>(t.productIds??[]).includes(a));if(n.length===0)return;t.productIds=(t.productIds??[]).filter(a=>!n.includes(a));const i=JSON.stringify(t);this.bundleStateManager.setState(i),this.fireEvent("bundle-products-removed",{productIds:t.productIds,removed:n}),await Le.getShadowGraphqlClient().mutate({mutation:Tp,variables:{id:this.id,bundleStateData:i},context:{bundleOwnerId:this.ownerId}})}}getTemplate(){return this.template}getTest(){return this.test}async generateQuoteId(){const t=(await Le.getShadowGraphqlClient().mutate({mutation:GV,variables:{id:this.id},context:{bundleOwnerId:this.ownerId}})).data?.bundleGenerateQuoteId?.quoteId;return this.quoteId=t,t||""}async attachAddress(e,t,n,i,a,s){await Le.getShadowGraphqlClient().mutate({mutation:zV,variables:{bundleId:this.id,streetAddress:e||void 0,apartment:t||void 0,city:n||void 0,country:i||void 0,state:a||void 0,postCode:s||void 0},context:{bundleOwnerId:this.ownerId}})}async attachOrganization(e){await Le.getShadowGraphqlClient().mutate({mutation:HV,variables:{bundleId:this.id,organizationName:e},context:{bundleOwnerId:this.ownerId}})}setBundleOptions(e){this.globalPropertyStateManager.setBundleOptions(e)}getInitializationPromise(){return this.initializationPromise}addEventListener(e,t){this.eventEmitter.on(e,t)}removeEventListener(e,t){this.eventEmitter.off(e,t)}getClient(){return this.client}getId(){return this.id}getName(){return this.name}getQuoteId(){return this.quoteId}setName(e){return this.name=e,this.updateBundle()}getDispatchDate(){return this.dispatchDate}setDispatchDate(e){return this.dispatchDate=e,this.updateBundle()}getPurchaseOrder(){return this.purchaseOrder}setPurchaseOrder(e){return this.purchaseOrder=e,this.updateBundle()}getMetadata(){return new Map(this.metadata)}setMetadata(e){return this.metadata=new Map(e),this.updateBundle()}setNameAndMetadata(e,t){return this.name=e,this.metadata=new Map(t),this.updateBundle()}hasGlobalProperties(){return!!this.getGlobalPropertyConfiguration()}getGlobalPropertyConfiguration(){return this.getDefaultGlobalPropertyConfiguration()}getDefaultGlobalPropertyConfiguration(){return this.originalGlobalPropertyConfiguration??this.activation?.globalPropertyConfiguration??this.productCollection?.globalPropertyConfiguration}async setGlobalPropertyConfiguration(e){await Le.getShadowGraphqlClient().mutate({mutation:q9,variables:{bundleId:this.id,globalPropertyConfigurationId:e.id},context:{bundleOwnerId:this.ownerId}}),this.overrideGlobalPropertyConfiguration=e,this.globalPropertyStateManager.setConfiguration(e)}async getGlobalProperties(){return this.globalPropertyHandleService.applyConditionsFromState(await this.globalPropertyHandleService.getHandles(),this.getGlobalPropertyStateManager().getGlobalPropertyState())}async applyGlobalPropertyState(e){this.updatesLocked=!0;const t=await this.globalPropertyHandleService.getHandles();try{for(const n of e.aspects){const i=n?.name;await this.getGlobalPropertyStateManager().setAspect(i,n.value,void 0,void 0,n.hidden)}for(const n of e.aspects){const i=n?.name,a=t.find(s=>s.getName()===i);if(a)switch(n.type){case Gn.FileUpload:{const s=a,o=await dg([n.value]);o.length>0&&await s.selectImage(o[0]);const l=n.storage?.colors;if(l){const u=Object.fromEntries(l.map(c=>[c.key,{browserValue:c.browserValue,pmsValue:c.pmsValue}])??[]);await s.changeColors(u)}break}case Gn.ColorOption:{const s=a,l=(await s.getAllVariants()).find(c=>c.getId()===n.value),u=n.storage?n.storage:void 0;l&&await s.selectVariant(l),u?.customColor&&s.setCustomColor(u.customColor);break}case Gn.Option:{const s=a,l=(await s.getAllVariants()).find(u=>u.getId()===n.value);l&&await s.selectVariant(l);break}case Gn.Text:{await a.setText(n.value);break}}}}finally{this.updatesLocked=!1,this.onGlobalPropertiesChanged(void 0,this.globalPropertyStateManager.getGlobalPropertyState())}}getGlobalPropertyStateManager(){return this.globalPropertyStateManager}async getGlobalPropertyTotalSubunits(){return(await this.globalPropertyHandleService.getHandles()).filter(n=>n.getType()===Gn.Option).map(n=>n.getCurrentVariant()?.getPrice()||0).reduce((n,i)=>n+i,0)}getTotalSubunits(){return this.workflowExperiences.map(e=>e.getTotalPriceSubunits()).reduce((e,t)=>e+t,0)}getProductCollection(){return this.productCollection?new Q1(this.productCollection):void 0}async initializeAdditionalRequiredColorChannels(e){for(const t of e.getStepsByType(Ye.Illustration)){const n=t.getGlobalPropertyAspects(this.getGlobalPropertyConfiguration()?.id||"");for(const i of n){const a=this.getGlobalPropertyConfiguration()?.aspects.find(s=>s.name===i);if(a&&a.type===Gn.ColorOption){const s=t.getCurrentVariant()?.getAssetResource(),o=s?.assetConfiguration?.channelNumbers||[],l=s?.assetConfiguration?.defaultColorVariants||[],u=eP(this,i),c=[...new Set(o.map(d=>d.number))];if(c.length>u)for(const d of c){const h=this.getGlobalPropertyStateManager(),g=l.find(y=>y.channelNumber===d);g&&await h.setAspect(i,g.variant.id||"",void 0,g.channelNumber)}}}}}async addWorkflowExperience(e){await this.initializeAdditionalRequiredColorChannels(e),e.setBundle(this),await this.appendWorkflowExperience(e),await this.injectExperienceIntoPreviewService(e),await e.getWorkflowManager().getInitializationPromise();const t=await this.getGlobalProperties();for(const n of t)await n.applyGlobalState([e]);this.fireEvent("workflow-experience-added",{workflowExperiences:[e]})}async addWorkflowExperiences(e){for(const o of e)await this.initializeAdditionalRequiredColorChannels(o);const t=e.map(o=>o.getTransaction().id),n=t.map(o=>this.workflowExperiences.find(l=>l.getTransaction().id===o));if(n.some(o=>!!o))throw new Error("Unable to add transaction to bundle - Already Exists: "+n.filter(o=>!!o).map(o=>o?.getTransaction().id).join(", "));const i=wr.getMap("transactionOwnerIds")||new Map,a=t.map(o=>i.get(o));await Le.getShadowGraphqlClient().mutate({mutation:L9,variables:{id:this.id,transactionIds:t,transactionOwnerIds:a},context:{bundleOwnerId:this.ownerId}}).catch(o=>{console.error(o)}),this.workflowExperiences.push(...e);const s=async()=>{for(const l of e)l.setBundle(this),await this.injectExperienceIntoPreviewService(l);await Promise.all(e.map(l=>l.getWorkflowManager().getInitializationPromise()));const o=await this.getGlobalProperties();for(const l of o)await l.applyGlobalState(e)};await Promise.all([this.updateTransactionOrder(),s()]),await this.initializeUninitializedHandles(),this.workflowExperiences.forEach(o=>o.checkForPriceBreakChanges()),this.fireEvent("workflow-experience-added",{workflowExperiences:this.workflowExperiences})}async appendWorkflowExperience(e,t=!0){const n=e.getTransaction().id;if(this.workflowExperiences.find(o=>o.getTransaction().id===n))throw new Error("Unable to add transaction to bundle - Already Exists!");const s=(wr.getMap("transactionOwnerIds")||new Map).get(n);await Le.getShadowGraphqlClient().mutate({mutation:N9,variables:{id:this.id,transactionId:n},context:{bundleOwnerId:this.ownerId,transactionOwnerId:s}}),t&&(this.workflowExperiences.push(e),this.workflowExperiences.forEach(o=>o.checkForPriceBreakChanges()))}async removeWorkflowExperience(e){const t=this.workflowExperiences.indexOf(e);await this.removeTransaction(t,this.workflowExperiences[t].getTransaction()),this.fireEvent("workflow-experience-added",{workflowExperiences:[e]})}async removeWorkflowExperiences(e){await this.removeTransactions(e.map(t=>t.getTransaction()))}async removeWorkflowExperienceByTransaction(e){const t=this.workflowExperiences.findIndex(n=>n.getTransaction().id===e.id);await this.removeTransaction(t,e)}async removeWorkflowExperiencesByTransactions(e){await this.removeTransactions(e)}async removeTransaction(e,t,n=!0){if(e>-1){const i=this.workflowExperiences.find(a=>a.getTransaction().id===t.id);if(i.setBundle(void 0),this.previewService&&i.getWorkflowManager().ejectFromPreviewService(),this.bundleStateManager.removeStateForTransaction(t.id),await Le.getShadowGraphqlClient().mutate({mutation:U9,variables:{id:this.id,transactionId:t.id,name:this.name,metadata:Array.from(this.metadata.entries()).map(([a,s])=>({key:a,value:s})),bundleStateData:this.bundleStateManager.getSerializedState()},context:{bundleOwnerId:this.ownerId}}),n){const a=this.workflowExperiences.splice(e,1);this.workflowExperiences.forEach(s=>s.checkForPriceBreakChanges()),i.checkForPriceBreakChanges(),await this.updateTransactionOrder(),this.fireEvent("workflow-experience-removed",{workflowExperiences:a})}}else throw new Error("Unable to remove workflow experience from bundle - Not Found! - "+t.id)}async removeTransactions(e){const t=e.map(i=>this.workflowExperiences.findIndex(a=>a.getTransaction().id===i.id));if(t.some(i=>i===-1))throw new Error("Unable to remove workflow experience from bundle - The following aren't included in the bundle: "+e.filter((i,a)=>t[a]===-1).map(i=>i.id).join(", "));const n=e.map(i=>this.workflowExperiences.splice(this.workflowExperiences.findIndex(a=>a.getTransaction().id===i.id),1)[0]);n.forEach(i=>i.setBundle(void 0)),[...this.workflowExperiences,...n].forEach(i=>i.checkForPriceBreakChanges()),this.previewService&&n.forEach(i=>i.getWorkflowManager().ejectFromPreviewService()),e.forEach(i=>this.bundleStateManager.removeStateForTransaction(i.id)),await Le.getShadowGraphqlClient().mutate({mutation:V9,variables:{id:this.id,transactionIds:e.map(i=>i.id),name:this.name,metadata:Array.from(this.metadata.entries()).map(([i,a])=>({key:i,value:a})),bundleStateData:this.bundleStateManager.getSerializedState()},context:{bundleOwnerId:this.ownerId}}),this.fireEvent("workflow-experience-removed",{workflowExperiences:n}),await this.updateTransactionOrder()}async insertWorkflowExperience(e,t){await this.appendWorkflowExperience(e,!1),this.workflowExperiences.splice(t,0,e),await Promise.all([this.updateTransactionOrder(),(async()=>{await this.injectExperienceIntoPreviewService(e);const n=await this.getGlobalProperties();await Promise.all(n.map(i=>i.applyGlobalState([e])))})()])}async replaceWorkflowExperience(e,t){if(e<0||e>=this.workflowExperiences.length)throw new Error("Unable to replace workflow experience in bundle - Index out of range!");const n=this.workflowExperiences[e];if(n.getTransaction().id===t.getTransaction().id)throw new Error("Unable to replace workflow experience in bundle - Same transaction!");await Promise.all([this.removeTransaction(e,n.getTransaction(),!1),this.appendWorkflowExperience(t,!1)]),this.workflowExperiences[e]=t,await Promise.all([this.updateTransactionOrder(),(async()=>{await this.injectExperienceIntoPreviewService(t);const i=await this.getGlobalProperties();await Promise.all(i.map(a=>a.applyGlobalState([t])))})()])}async swapWorkflowExperiences(e,t){if(e<0||e>=this.workflowExperiences.length||t<0||t>=this.workflowExperiences.length)throw new Error("Unable to swap workflow experiences in bundle - Index out of range!");if(e===t)return;const n=this.workflowExperiences[e];this.workflowExperiences[e]=this.workflowExperiences[t],this.workflowExperiences[t]=n,await this.updateTransactionOrder()}getWorkflowExperiences(){return[...this.workflowExperiences]}getTopLevelWorkflowExperiences(){return this.workflowExperiences.filter(e=>!e.getTransaction().parentTransaction)}getChildWorkflowExperiences(e){return this.workflowExperiences.filter(t=>t.getTransaction().parentTransaction?.id===e)}async sortWorkflowExperiences(e){this.workflowExperiences=this.workflowExperiences.sort(e),await this.updateTransactionOrder()}getWorkflowExperienceCount(){return this.workflowExperiences.length}async addStakeholder(e,t){const n=await Le.getShadowGraphqlClient().mutate({mutation:$9,variables:{id:this.id,details:e,type:t||t1.Owner},context:{bundleOwnerId:this.ownerId}});if(!n.data?.bundleAddStakeholder)throw new Error("Bundle not found!");const i=n.data.bundleAddStakeholder.bundleStakeholders||[];this.storeStakeholderCustomers(i)}async removeStakeholder(e){if(!(await Le.getShadowGraphqlClient().mutate({mutation:z9,variables:{id:this.id,emailAddress:e},context:{bundleOwnerId:this.ownerId}})).data?.bundleRemoveStakeholder)throw new Error("Bundle not found!")}async updateStakeholders(e){const t=await Le.getShadowGraphqlClient().mutate({mutation:H9,variables:{id:this.id,input:e},context:{bundleOwnerId:this.ownerId}});if(!t.data?.bundleUpdateStakeholders)throw new Error("Bundle not found!");const n=t.data.bundleUpdateStakeholders.bundleStakeholders||[];this.storeStakeholderCustomers(n)}async getAllStakeholders(){const e=await Le.getShadowGraphqlClient().query({query:BE,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.id},context:{bundleOwnerId:this.ownerId}});if(!e.data.bundles||e.data.bundles.length===0)throw new Error("Bundle not found!");const t=e.data.bundles[0].bundleStakeholders||[];return this.storeStakeholderCustomers(t),t}async getCurrentStakeholder(){const e=await Le.getShadowGraphqlClient().query({query:BE,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.id},context:{bundleOwnerId:this.ownerId}});if(!e.data.bundles||e.data.bundles.length===0)throw new Error("Bundle not found!");return e.data.bundles[0].currentBundleStakeholder}storeStakeholderCustomers(e){e.forEach(t=>{t.customer&&this.client.storeCustomer(t.customer)})}async finish(e,t){this.completed&&await Le.getShadowGraphqlClient().mutate({mutation:Q9,variables:{bundleId:this.id}});const n=this.workflowExperiences.filter(o=>!!o.getWorkflow()),i=this.workflowExperiences.filter(o=>!o.getWorkflow()&&!!o.getTransaction().parentTransaction?.id).map(o=>o.getTransaction()),a=await JI(n.map(o=>{const l=o.getWorkflow();if(!l)throw new Error("Unable to create designs - Workflow not found!");const u=o.getProduct();if(!u)throw new Error("Unable to create designs - Product not found!");return{workflowManager:o.getWorkflowManager(),workflow:l,layouts:o.getWorkflowManager().getLayouts(),getReducerState:()=>o.getCommandContext().getState(),product:u,transaction:o.getTransaction(),workflowSelections:o.getWorkflowManager().getWorkflowSelections(),designName:l.name,workflowMetadata:o.getWorkflowManager().getWorkflowMetadata()}}),t?(o,l)=>{const u=n.find(c=>c.getTransaction().id===l);return u?t(u,o):(console.warn("SpiffCommerce - Bundle create design - Unable to find experience for transaction: "+l),Promise.resolve(void 0))}:void 0),s=new Map;return n.forEach((o,l)=>{s.set(o.getTransaction().id,a[l])}),await yV(i),vV(s,i),{bundleId:this.id,name:this.getName(),dispatchDate:this.getDispatchDate()||"",purchaseOrder:this.getPurchaseOrder()||"",collectionId:this.getProductCollection()?.getId()||"",collectionName:this.getProductCollection()?.getName()||"",items:a,bundleOwnerId:this.ownerId}}async placeOrder(){const e=this.workflowExperiences.map(t=>({transactionId:t.getTransaction().id,amountToOrder:t.getTransaction().quantity||1}));return await this.getClient().placeOrder(e)}getPreviewService(){return this.previewService}async setPreviewService(e){if(this.workflowExperiences&&this.workflowExperiences.length>0&&(this.workflowExperiences.forEach(t=>t.getWorkflowManager().ejectFromPreviewService()),e))for(const t of this.workflowExperiences)await this.injectExperienceIntoPreviewService(t);e&&e.registerModelLoadEventListener&&e.registerModelLoadEventListener(this.onModelLoadEvent.bind(this)),this.previewService&&this.previewService!==e&&this.previewService.unregisterModelLoadEventListener&&this.previewService.unregisterModelLoadEventListener(this.onModelLoadEvent.bind(this)),this.previewService=e}async assignProductCollection(e){const t=await Le.getShadowGraphqlClient().mutate({mutation:j9(this.globalPropertyStateManager.getBundleOptions()?.eagerFetchProducts??!1),variables:{id:this.id,productCollectionId:e??""},context:{bundleOwnerId:this.ownerId}});if(t.data?.bundleAssignProductCollection.productCollection){this.productCollection=t.data.bundleAssignProductCollection.productCollection;const n=this.getGlobalPropertyConfiguration();this.globalPropertyStateManager.setConfiguration(n),await this.globalPropertyHandleService.getHandles(),await this.clearOldProducts(this.workflowExperiences)}}onModelLoadEvent(e){e.eventType==="unload"||!e.modelContainer||(e.modelContainer.registerMaterialSelectedCallback(()=>this.onModelSelectedEvent(e.modelContainer,!0)),e.modelContainer.registerMaterialDeselectedCallback(()=>this.onModelSelectedEvent(e.modelContainer,!1)))}onModelSelectedEvent(e,t){if(e&&e.metadata&&e.metadata instanceof Map&&e.metadata.has("workflowManager")){const i=e.metadata.get("workflowManager").getWorkflowExperience().getTransaction(),a=this.workflowExperiences.find(s=>s.getTransaction().id===i.id);a&&this.fireEvent(t?"workflow-experience-hover-enter":"workflow-experience-hover-exit",{workflowExperience:a})}}async injectExperienceIntoPreviewService(e){this.previewService&&await e.getWorkflowManager().injectIntoPreviewService(this.previewService)}async loadExistingWorkflowExperiences(e,t,n){let i=[];if(e.length>0&&(i=await this.client.getWorkflowExperiences(e.map(a=>({type:"transaction",transactionId:a})),t,void 0,n),i.forEach(a=>a.setBundle(this)),i.forEach(a=>a.checkForPriceBreakChanges()),this.workflowExperiences=i,this.previewService))for(const a of i)await this.injectExperienceIntoPreviewService(a);await this.clearOldProducts(i)}async clearOldProducts(e){if(!this.globalPropertyStateManager.getBundleOptions()?.readonly){const t=this.getProductIds()||[],n=this.getProductCollection();if(n&&t.length>0){await n.fetchProducts();const i=n.getProducts(),a=[],s=[];for(const l of t)if(!i.find(c=>c.getId()===l)){for(const c of e)c.getProduct()?.id===l&&s.push(c);a.push(l)}const o=[];a.length>0&&o.push(this.removeProductIds(a)),s.length>0&&o.push(Promise.all(s.map(l=>l.clearProduct()))),o.length>0&&await Promise.all(o)}}}async updateBundle(){if(!(await Le.getShadowGraphqlClient().mutate({mutation:Tp,variables:{id:this.id,name:this.name,metadata:Array.from(this.metadata.entries()).map(([t,n])=>({key:t,value:n})),bundleStateData:this.bundleStateManager.getSerializedState(),dispatchDate:this.dispatchDate,purchaseOrder:this.purchaseOrder},context:{bundleOwnerId:this.ownerId}})).data?.bundleUpdate)throw new Error("Bundle not found!")}async updateTransactionOrder(){await Le.getShadowGraphqlClient().mutate({mutation:G9,variables:{id:this.id,transactionIds:this.workflowExperiences.map(e=>e.getTransaction().id)},context:{bundleOwnerId:this.ownerId}})}async onGlobalPropertiesChanged(e,t){if(this.updatesLocked)return;const n=await this.globalPropertyHandleService.getHandles(),i=this.globalPropertyHandleService.applyConditionsFromState(n,e),a=this.globalPropertyHandleService.applyConditionsFromState(n,t);this.checkConditionalHandlesChanged(i,a),this.checkMandatoryHandlesChanged(e,a);const s=this.getGlobalPropertyStateManager();let o=[];for(const f of n)a.find(d=>d.getName()==f.getName())||(o=[...o,f.getName()]);await s.clearAspects(o);const l=a.map(f=>{if(f.getType()===Gn.ColorOption||f.getType()===Gn.Option){const d=f;if(!t.aspects.find(g=>g.name===d.getName()))return d.initDefaultVariant()}});await Promise.all(l),await Promise.all(a.map(f=>f.applyGlobalState()));const u=this.globalPropertyStateManager.getGlobalPropertyState(),c=this.globalPropertyHandleService.applyConditionsFromState(n,u);wf(a.sort(),c.sort())||(this.checkConditionalHandlesChanged(a,c),this.checkMandatoryHandlesChanged(u,c),await this.onGlobalPropertiesChanged(t,u))}checkConditionalHandlesChanged(e,t){(()=>{if(e.length!==t.length)return!0;for(let a=0;a<e.length;a++)if(e[a].getName()!==t[a].getName())return!0;return!1})()&&this.fireEvent("conditional-global-properties-changed",{globalProperties:t})}checkMandatoryHandlesChanged(e,t){const n=[],i=[],a=[],s=tP(e);t.forEach(o=>{if(o.isMandatory()){const l=o.isMandatoryFulfilled();l?i.push(o):a.push(o);const u=s.get(o.getName());(u===void 0||u!==l)&&n.push(o)}}),this.fireEvent("global-properties-mandatory-changed",{changed:n,completed:i,remaining:a})}fireEvent(e,t){this.eventEmitter.emit(e,t)}getShareActions(){return this.shareActions}getWorkflowViewerLink(){return this.workflowViewerLink}getWorkflowViewerAmendLink(){return this.workflowViewerAmendLink}async approve(e,t){await Le.getShadowGraphqlClient().mutate({mutation:Y9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.id,note:e,stakeholderId:t}})}async reject(e,t){await Le.getShadowGraphqlClient().mutate({mutation:X9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.id,note:e,stakeholderId:t}})}getQuoteCompleteMessage(){return{bundleId:this.id,bundleOwnerId:this.ownerId,quoteId:this.quoteId||""}}}const jV=Ce`
|
|
2898
|
+
`;class HE{constructor(e,t,n,i,a,s,o){this.workflowExperiences=[],this.eventEmitter=new zV,this.updatesLocked=!1,this.client=e,this.id=t.id,this.name=t.name||"",this.dispatchDate=t.dispatchDate,this.purchaseOrder=t.purchaseOrder,this.template=t.template||!1,this.test=t.test||!1,this.quoteId=t.quoteId,this.shareActions=t.bundleShareActions,this.workflowViewerLink=t.workflowViewerLink,this.workflowViewerAmendLink=t.workflowViewerAmendLink,this.ownerId=a,this.metadata=new Map(t.metadata?.map(l=>[l.key,l.value])||[]),this.completed=t.completed??!1,this.productCollection=t.productCollection,this.activation=t.activation,this.bundleStateManager=new NV(t.bundleStateData),this.originalGlobalPropertyConfiguration=t.globalPropertyConfiguration,this.globalPropertyStateManager=new _V(this.id,this.ownerId,this.getGlobalPropertyConfiguration(),this.onGlobalPropertiesChanged.bind(this),s),this.globalPropertyHandleService=new FV(this),this.setPreviewService(n),this.initializationPromise=(async()=>{if(!s?.readonly){const l=this.bundleStateManager.getState();if(l.integrationProductIds&&l.integrationProductIds.length>0){const u=await Le.getShadowGraphqlClient().query({query:PT,variables:{ids:l.integrationProductIds},errorPolicy:"all",fetchPolicy:"no-cache"});if(u.errors)throw new Error(`Failed to fetch integration products for Bundle ${t.id}`);const c=u.data.integrationProducts?.filter(d=>!!d.product?.id&&l.integrationProductIds.includes(d.id)).map(d=>d.product.id);l.integrationProductIds=[],l.productIds=Array.from(new Set([...l.productIds||[],...c||[]]));const f=JSON.stringify(l);this.bundleStateManager.setState(f),await Le.getShadowGraphqlClient().mutate({mutation:Tp,variables:{id:this.id,bundleStateData:f},context:{bundleOwnerId:a}})}}return Promise.all([this.loadExistingWorkflowExperiences(t.transactionIds||[],{...i,bundleOwnerId:a},o),this.globalPropertyStateManager.getInitializationPromise()]).then(()=>new Promise((l,u)=>{if(s?.readonly){l([]);return}console.log("Setting default global variants."),this.initializeUninitializedHandles().then(l).catch(u)}))})(),this.initializationPromise.catch(l=>{console.error(`Bundle initialization failed: ${l}`)}),this.initializationPromise.then(()=>{this.getGlobalProperties().then(l=>this.checkMandatoryHandlesChanged(void 0,l))})}async initializeUninitializedHandles(){const e=this.globalPropertyStateManager.getGlobalPropertyState();if(!e)return console.log("Attempted to set global default variant before state was initialized."),[];const n=(await this.globalPropertyHandleService.getHandles()).map(async i=>{if(i.getType()===Gn.ColorOption||i.getType()===Gn.Option){const a=i;if(!e.aspects.find(o=>o.name===a.getName()))try{return await a.initDefaultVariant()}catch(o){console.error(`Failed to initialize default global variant - ${o}`)}}});return Promise.all(n)}getProductIds(){return this.bundleStateManager.getState()?.productIds}async addProductId(e){const t=this.bundleStateManager.getState();if(t){if(!t.productIds)t.productIds=[];else if(t.productIds.some(i=>i===e)){this.fireEvent("bundle-products-added",{productIds:t.productIds,added:[]});return}t.productIds=[...t.productIds,e];const n=JSON.stringify(t);this.bundleStateManager.setState(n),this.fireEvent("bundle-products-added",{productIds:t.productIds,added:[e]}),await Le.getShadowGraphqlClient().mutate({mutation:Tp,variables:{id:this.id,bundleStateData:n},context:{bundleOwnerId:this.ownerId}})}}async removeProductIds(e){const t=this.bundleStateManager.getState();if(t){const n=e.filter(a=>(t.productIds??[]).includes(a));if(n.length===0)return;t.productIds=(t.productIds??[]).filter(a=>!n.includes(a));const i=JSON.stringify(t);this.bundleStateManager.setState(i),this.fireEvent("bundle-products-removed",{productIds:t.productIds,removed:n}),await Le.getShadowGraphqlClient().mutate({mutation:Tp,variables:{id:this.id,bundleStateData:i},context:{bundleOwnerId:this.ownerId}})}}getTemplate(){return this.template}getTest(){return this.test}async generateQuoteId(){const t=(await Le.getShadowGraphqlClient().mutate({mutation:jV,variables:{id:this.id},context:{bundleOwnerId:this.ownerId}})).data?.bundleGenerateQuoteId?.quoteId;return this.quoteId=t,t||""}async attachAddress(e,t,n,i,a,s){await Le.getShadowGraphqlClient().mutate({mutation:HV,variables:{bundleId:this.id,streetAddress:e||void 0,apartment:t||void 0,city:n||void 0,country:i||void 0,state:a||void 0,postCode:s||void 0},context:{bundleOwnerId:this.ownerId}})}async attachOrganization(e){await Le.getShadowGraphqlClient().mutate({mutation:GV,variables:{bundleId:this.id,organizationName:e},context:{bundleOwnerId:this.ownerId}})}setBundleOptions(e){this.globalPropertyStateManager.setBundleOptions(e)}getInitializationPromise(){return this.initializationPromise}addEventListener(e,t){this.eventEmitter.on(e,t)}removeEventListener(e,t){this.eventEmitter.off(e,t)}getClient(){return this.client}getId(){return this.id}getName(){return this.name}getQuoteId(){return this.quoteId}setName(e){return this.name=e,this.updateBundle()}getDispatchDate(){return this.dispatchDate}setDispatchDate(e){return this.dispatchDate=e,this.updateBundle()}getPurchaseOrder(){return this.purchaseOrder}setPurchaseOrder(e){return this.purchaseOrder=e,this.updateBundle()}getMetadata(){return new Map(this.metadata)}setMetadata(e){return this.metadata=new Map(e),this.updateBundle()}setNameAndMetadata(e,t){return this.name=e,this.metadata=new Map(t),this.updateBundle()}hasGlobalProperties(){return!!this.getGlobalPropertyConfiguration()}getGlobalPropertyConfiguration(){return this.getDefaultGlobalPropertyConfiguration()}getDefaultGlobalPropertyConfiguration(){return this.originalGlobalPropertyConfiguration??this.activation?.globalPropertyConfiguration??this.productCollection?.globalPropertyConfiguration}async setGlobalPropertyConfiguration(e){await Le.getShadowGraphqlClient().mutate({mutation:W9,variables:{bundleId:this.id,globalPropertyConfigurationId:e.id},context:{bundleOwnerId:this.ownerId}}),this.overrideGlobalPropertyConfiguration=e,this.globalPropertyStateManager.setConfiguration(e)}async getGlobalProperties(){return this.globalPropertyHandleService.applyConditionsFromState(await this.globalPropertyHandleService.getHandles(),this.getGlobalPropertyStateManager().getGlobalPropertyState())}async applyGlobalPropertyState(e){this.updatesLocked=!0;const t=await this.globalPropertyHandleService.getHandles();try{for(const n of e.aspects){const i=n?.name;await this.getGlobalPropertyStateManager().setAspect(i,n.value,void 0,void 0,n.hidden)}for(const n of e.aspects){const i=n?.name,a=t.find(s=>s.getName()===i);if(a)switch(n.type){case Gn.FileUpload:{const s=a,o=await dg([n.value]);o.length>0&&await s.selectImage(o[0]);const l=n.storage?.colors;if(l){const u=Object.fromEntries(l.map(c=>[c.key,{browserValue:c.browserValue,pmsValue:c.pmsValue}])??[]);await s.changeColors(u)}break}case Gn.ColorOption:{const s=a,l=(await s.getAllVariants()).find(c=>c.getId()===n.value),u=n.storage?n.storage:void 0;l&&await s.selectVariant(l),u?.customColor&&s.setCustomColor(u.customColor);break}case Gn.Option:{const s=a,l=(await s.getAllVariants()).find(u=>u.getId()===n.value);l&&await s.selectVariant(l);break}case Gn.Text:{await a.setText(n.value);break}}}}finally{this.updatesLocked=!1,this.onGlobalPropertiesChanged(void 0,this.globalPropertyStateManager.getGlobalPropertyState())}}getGlobalPropertyStateManager(){return this.globalPropertyStateManager}async getGlobalPropertyTotalSubunits(){return(await this.globalPropertyHandleService.getHandles()).filter(n=>n.getType()===Gn.Option).map(n=>n.getCurrentVariant()?.getPrice()||0).reduce((n,i)=>n+i,0)}getTotalSubunits(){return this.workflowExperiences.map(e=>e.getTotalPriceSubunits()).reduce((e,t)=>e+t,0)}getProductCollection(){return this.productCollection?new Q1(this.productCollection):void 0}async initializeAdditionalRequiredColorChannels(e){for(const t of e.getStepsByType(Ye.Illustration)){const n=t.getGlobalPropertyAspects(this.getGlobalPropertyConfiguration()?.id||"");for(const i of n){const a=this.getGlobalPropertyConfiguration()?.aspects.find(s=>s.name===i);if(a&&a.type===Gn.ColorOption){const s=t.getCurrentVariant()?.getAssetResource(),o=s?.assetConfiguration?.channelNumbers||[],l=s?.assetConfiguration?.defaultColorVariants||[],u=eP(this,i),c=[...new Set(o.map(d=>d.number))];if(c.length>u)for(const d of c){const h=this.getGlobalPropertyStateManager(),g=l.find(y=>y.channelNumber===d);g&&await h.setAspect(i,g.variant.id||"",void 0,g.channelNumber)}}}}}async addWorkflowExperience(e){await this.initializeAdditionalRequiredColorChannels(e),e.setBundle(this),await this.appendWorkflowExperience(e),await this.injectExperienceIntoPreviewService(e),await e.getWorkflowManager().getInitializationPromise();const t=await this.getGlobalProperties();for(const n of t)await n.applyGlobalState([e]);this.fireEvent("workflow-experience-added",{workflowExperiences:[e]})}async addWorkflowExperiences(e){for(const o of e)await this.initializeAdditionalRequiredColorChannels(o);const t=e.map(o=>o.getTransaction().id),n=t.map(o=>this.workflowExperiences.find(l=>l.getTransaction().id===o));if(n.some(o=>!!o))throw new Error("Unable to add transaction to bundle - Already Exists: "+n.filter(o=>!!o).map(o=>o?.getTransaction().id).join(", "));const i=wr.getMap("transactionOwnerIds")||new Map,a=t.map(o=>i.get(o));await Le.getShadowGraphqlClient().mutate({mutation:U9,variables:{id:this.id,transactionIds:t,transactionOwnerIds:a},context:{bundleOwnerId:this.ownerId}}).catch(o=>{console.error(o)}),this.workflowExperiences.push(...e);const s=async()=>{for(const l of e)l.setBundle(this),await this.injectExperienceIntoPreviewService(l);await Promise.all(e.map(l=>l.getWorkflowManager().getInitializationPromise()));const o=await this.getGlobalProperties();for(const l of o)await l.applyGlobalState(e)};await Promise.all([this.updateTransactionOrder(),s()]),await this.initializeUninitializedHandles(),this.workflowExperiences.forEach(o=>o.checkForPriceBreakChanges()),this.fireEvent("workflow-experience-added",{workflowExperiences:this.workflowExperiences})}async appendWorkflowExperience(e,t=!0){const n=e.getTransaction().id;if(this.workflowExperiences.find(o=>o.getTransaction().id===n))throw new Error("Unable to add transaction to bundle - Already Exists!");const s=(wr.getMap("transactionOwnerIds")||new Map).get(n);await Le.getShadowGraphqlClient().mutate({mutation:L9,variables:{id:this.id,transactionId:n},context:{bundleOwnerId:this.ownerId,transactionOwnerId:s}}),t&&(this.workflowExperiences.push(e),this.workflowExperiences.forEach(o=>o.checkForPriceBreakChanges()))}async removeWorkflowExperience(e){const t=this.workflowExperiences.indexOf(e);await this.removeTransaction(t,this.workflowExperiences[t].getTransaction()),this.fireEvent("workflow-experience-added",{workflowExperiences:[e]})}async removeWorkflowExperiences(e){await this.removeTransactions(e.map(t=>t.getTransaction()))}async removeWorkflowExperienceByTransaction(e){const t=this.workflowExperiences.findIndex(n=>n.getTransaction().id===e.id);await this.removeTransaction(t,e)}async removeWorkflowExperiencesByTransactions(e){await this.removeTransactions(e)}async removeTransaction(e,t,n=!0){if(e>-1){const i=this.workflowExperiences.find(a=>a.getTransaction().id===t.id);if(i.setBundle(void 0),this.previewService&&i.getWorkflowManager().ejectFromPreviewService(),this.bundleStateManager.removeStateForTransaction(t.id),await Le.getShadowGraphqlClient().mutate({mutation:V9,variables:{id:this.id,transactionId:t.id,name:this.name,metadata:Array.from(this.metadata.entries()).map(([a,s])=>({key:a,value:s})),bundleStateData:this.bundleStateManager.getSerializedState()},context:{bundleOwnerId:this.ownerId}}),n){const a=this.workflowExperiences.splice(e,1);this.workflowExperiences.forEach(s=>s.checkForPriceBreakChanges()),i.checkForPriceBreakChanges(),await this.updateTransactionOrder(),this.fireEvent("workflow-experience-removed",{workflowExperiences:a})}}else throw new Error("Unable to remove workflow experience from bundle - Not Found! - "+t.id)}async removeTransactions(e){const t=e.map(i=>this.workflowExperiences.findIndex(a=>a.getTransaction().id===i.id));if(t.some(i=>i===-1))throw new Error("Unable to remove workflow experience from bundle - The following aren't included in the bundle: "+e.filter((i,a)=>t[a]===-1).map(i=>i.id).join(", "));const n=e.map(i=>this.workflowExperiences.splice(this.workflowExperiences.findIndex(a=>a.getTransaction().id===i.id),1)[0]);n.forEach(i=>i.setBundle(void 0)),[...this.workflowExperiences,...n].forEach(i=>i.checkForPriceBreakChanges()),this.previewService&&n.forEach(i=>i.getWorkflowManager().ejectFromPreviewService()),e.forEach(i=>this.bundleStateManager.removeStateForTransaction(i.id)),await Le.getShadowGraphqlClient().mutate({mutation:$9,variables:{id:this.id,transactionIds:e.map(i=>i.id),name:this.name,metadata:Array.from(this.metadata.entries()).map(([i,a])=>({key:i,value:a})),bundleStateData:this.bundleStateManager.getSerializedState()},context:{bundleOwnerId:this.ownerId}}),this.fireEvent("workflow-experience-removed",{workflowExperiences:n}),await this.updateTransactionOrder()}async insertWorkflowExperience(e,t){await this.appendWorkflowExperience(e,!1),this.workflowExperiences.splice(t,0,e),await Promise.all([this.updateTransactionOrder(),(async()=>{await this.injectExperienceIntoPreviewService(e);const n=await this.getGlobalProperties();await Promise.all(n.map(i=>i.applyGlobalState([e])))})()])}async replaceWorkflowExperience(e,t){if(e<0||e>=this.workflowExperiences.length)throw new Error("Unable to replace workflow experience in bundle - Index out of range!");const n=this.workflowExperiences[e];if(n.getTransaction().id===t.getTransaction().id)throw new Error("Unable to replace workflow experience in bundle - Same transaction!");await Promise.all([this.removeTransaction(e,n.getTransaction(),!1),this.appendWorkflowExperience(t,!1)]),this.workflowExperiences[e]=t,await Promise.all([this.updateTransactionOrder(),(async()=>{await this.injectExperienceIntoPreviewService(t);const i=await this.getGlobalProperties();await Promise.all(i.map(a=>a.applyGlobalState([t])))})()])}async swapWorkflowExperiences(e,t){if(e<0||e>=this.workflowExperiences.length||t<0||t>=this.workflowExperiences.length)throw new Error("Unable to swap workflow experiences in bundle - Index out of range!");if(e===t)return;const n=this.workflowExperiences[e];this.workflowExperiences[e]=this.workflowExperiences[t],this.workflowExperiences[t]=n,await this.updateTransactionOrder()}getWorkflowExperiences(){return[...this.workflowExperiences]}getTopLevelWorkflowExperiences(){return this.workflowExperiences.filter(e=>!e.getTransaction().parentTransaction)}getChildWorkflowExperiences(e){return this.workflowExperiences.filter(t=>t.getTransaction().parentTransaction?.id===e)}async sortWorkflowExperiences(e){this.workflowExperiences=this.workflowExperiences.sort(e),await this.updateTransactionOrder()}getWorkflowExperienceCount(){return this.workflowExperiences.length}async addStakeholder(e,t){const n=await Le.getShadowGraphqlClient().mutate({mutation:z9,variables:{id:this.id,details:e,type:t||t1.Owner},context:{bundleOwnerId:this.ownerId}});if(!n.data?.bundleAddStakeholder)throw new Error("Bundle not found!");const i=n.data.bundleAddStakeholder.bundleStakeholders||[];this.storeStakeholderCustomers(i)}async removeStakeholder(e){if(!(await Le.getShadowGraphqlClient().mutate({mutation:H9,variables:{id:this.id,emailAddress:e},context:{bundleOwnerId:this.ownerId}})).data?.bundleRemoveStakeholder)throw new Error("Bundle not found!")}async updateStakeholders(e){const t=await Le.getShadowGraphqlClient().mutate({mutation:G9,variables:{id:this.id,input:e},context:{bundleOwnerId:this.ownerId}});if(!t.data?.bundleUpdateStakeholders)throw new Error("Bundle not found!");const n=t.data.bundleUpdateStakeholders.bundleStakeholders||[];this.storeStakeholderCustomers(n)}async getAllStakeholders(){const e=await Le.getShadowGraphqlClient().query({query:BE,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.id},context:{bundleOwnerId:this.ownerId}});if(!e.data.bundles||e.data.bundles.length===0)throw new Error("Bundle not found!");const t=e.data.bundles[0].bundleStakeholders||[];return this.storeStakeholderCustomers(t),t}async getCurrentStakeholder(){const e=await Le.getShadowGraphqlClient().query({query:BE,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.id},context:{bundleOwnerId:this.ownerId}});if(!e.data.bundles||e.data.bundles.length===0)throw new Error("Bundle not found!");return e.data.bundles[0].currentBundleStakeholder}storeStakeholderCustomers(e){e.forEach(t=>{t.customer&&this.client.storeCustomer(t.customer)})}async finish(e,t){this.completed&&await Le.getShadowGraphqlClient().mutate({mutation:Y9,variables:{bundleId:this.id}});const n=this.workflowExperiences.filter(o=>!!o.getWorkflow()),i=this.workflowExperiences.filter(o=>!o.getWorkflow()&&!!o.getTransaction().parentTransaction?.id).map(o=>o.getTransaction()),a=await JI(n.map(o=>{const l=o.getWorkflow();if(!l)throw new Error("Unable to create designs - Workflow not found!");const u=o.getProduct();if(!u)throw new Error("Unable to create designs - Product not found!");return{workflowManager:o.getWorkflowManager(),workflow:l,layouts:o.getWorkflowManager().getLayouts(),getReducerState:()=>o.getCommandContext().getState(),product:u,transaction:o.getTransaction(),workflowSelections:o.getWorkflowManager().getWorkflowSelections(),designName:l.name,workflowMetadata:o.getWorkflowManager().getWorkflowMetadata()}}),t?(o,l)=>{const u=n.find(c=>c.getTransaction().id===l);return u?t(u,o):(console.warn("SpiffCommerce - Bundle create design - Unable to find experience for transaction: "+l),Promise.resolve(void 0))}:void 0),s=new Map;return n.forEach((o,l)=>{s.set(o.getTransaction().id,a[l])}),await vV(i),AV(s,i),{bundleId:this.id,name:this.getName(),dispatchDate:this.getDispatchDate()||"",purchaseOrder:this.getPurchaseOrder()||"",collectionId:this.getProductCollection()?.getId()||"",collectionName:this.getProductCollection()?.getName()||"",items:a,bundleOwnerId:this.ownerId}}async placeOrder(){const e=this.workflowExperiences.map(t=>({transactionId:t.getTransaction().id,amountToOrder:t.getTransaction().quantity||1}));return await this.getClient().placeOrder(e)}getPreviewService(){return this.previewService}async setPreviewService(e){if(this.workflowExperiences&&this.workflowExperiences.length>0&&(this.workflowExperiences.forEach(t=>t.getWorkflowManager().ejectFromPreviewService()),e))for(const t of this.workflowExperiences)await this.injectExperienceIntoPreviewService(t);e&&e.registerModelLoadEventListener&&e.registerModelLoadEventListener(this.onModelLoadEvent.bind(this)),this.previewService&&this.previewService!==e&&this.previewService.unregisterModelLoadEventListener&&this.previewService.unregisterModelLoadEventListener(this.onModelLoadEvent.bind(this)),this.previewService=e}async assignProductCollection(e){const t=await Le.getShadowGraphqlClient().mutate({mutation:q9(this.globalPropertyStateManager.getBundleOptions()?.eagerFetchProducts??!1),variables:{id:this.id,productCollectionId:e??""},context:{bundleOwnerId:this.ownerId}});if(t.data?.bundleAssignProductCollection.productCollection){this.productCollection=t.data.bundleAssignProductCollection.productCollection;const n=this.getGlobalPropertyConfiguration();this.globalPropertyStateManager.setConfiguration(n),await this.globalPropertyHandleService.getHandles(),await this.clearOldProducts(this.workflowExperiences)}}onModelLoadEvent(e){e.eventType==="unload"||!e.modelContainer||(e.modelContainer.registerMaterialSelectedCallback(()=>this.onModelSelectedEvent(e.modelContainer,!0)),e.modelContainer.registerMaterialDeselectedCallback(()=>this.onModelSelectedEvent(e.modelContainer,!1)))}onModelSelectedEvent(e,t){if(e&&e.metadata&&e.metadata instanceof Map&&e.metadata.has("workflowManager")){const i=e.metadata.get("workflowManager").getWorkflowExperience().getTransaction(),a=this.workflowExperiences.find(s=>s.getTransaction().id===i.id);a&&this.fireEvent(t?"workflow-experience-hover-enter":"workflow-experience-hover-exit",{workflowExperience:a})}}async injectExperienceIntoPreviewService(e){this.previewService&&await e.getWorkflowManager().injectIntoPreviewService(this.previewService)}async loadExistingWorkflowExperiences(e,t,n){let i=[];if(e.length>0&&(i=await this.client.getWorkflowExperiences(e.map(a=>({type:"transaction",transactionId:a})),t,void 0,n),i.forEach(a=>a.setBundle(this)),i.forEach(a=>a.checkForPriceBreakChanges()),this.workflowExperiences=i,this.previewService))for(const a of i)await this.injectExperienceIntoPreviewService(a);await this.clearOldProducts(i)}async clearOldProducts(e){if(!this.globalPropertyStateManager.getBundleOptions()?.readonly){const t=this.getProductIds()||[],n=this.getProductCollection();if(n&&t.length>0){await n.fetchProducts();const i=n.getProducts(),a=[],s=[];for(const l of t)if(!i.find(c=>c.getId()===l)){for(const c of e)c.getProduct()?.id===l&&s.push(c);a.push(l)}const o=[];a.length>0&&o.push(this.removeProductIds(a)),s.length>0&&o.push(Promise.all(s.map(l=>l.clearProduct()))),o.length>0&&await Promise.all(o)}}}async updateBundle(){if(!(await Le.getShadowGraphqlClient().mutate({mutation:Tp,variables:{id:this.id,name:this.name,metadata:Array.from(this.metadata.entries()).map(([t,n])=>({key:t,value:n})),bundleStateData:this.bundleStateManager.getSerializedState(),dispatchDate:this.dispatchDate,purchaseOrder:this.purchaseOrder},context:{bundleOwnerId:this.ownerId}})).data?.bundleUpdate)throw new Error("Bundle not found!")}async updateTransactionOrder(){await Le.getShadowGraphqlClient().mutate({mutation:j9,variables:{id:this.id,transactionIds:this.workflowExperiences.map(e=>e.getTransaction().id)},context:{bundleOwnerId:this.ownerId}})}async onGlobalPropertiesChanged(e,t){if(this.updatesLocked)return;const n=await this.globalPropertyHandleService.getHandles(),i=this.globalPropertyHandleService.applyConditionsFromState(n,e),a=this.globalPropertyHandleService.applyConditionsFromState(n,t);this.checkConditionalHandlesChanged(i,a),this.checkMandatoryHandlesChanged(e,a);const s=this.getGlobalPropertyStateManager();let o=[];for(const f of n)a.find(d=>d.getName()==f.getName())||(o=[...o,f.getName()]);await s.clearAspects(o);const l=a.map(f=>{if(f.getType()===Gn.ColorOption||f.getType()===Gn.Option){const d=f;if(!t.aspects.find(g=>g.name===d.getName()))return d.initDefaultVariant()}});await Promise.all(l),await Promise.all(a.map(f=>f.applyGlobalState()));const u=this.globalPropertyStateManager.getGlobalPropertyState(),c=this.globalPropertyHandleService.applyConditionsFromState(n,u);wf(a.sort(),c.sort())||(this.checkConditionalHandlesChanged(a,c),this.checkMandatoryHandlesChanged(u,c),await this.onGlobalPropertiesChanged(t,u))}checkConditionalHandlesChanged(e,t){(()=>{if(e.length!==t.length)return!0;for(let a=0;a<e.length;a++)if(e[a].getName()!==t[a].getName())return!0;return!1})()&&this.fireEvent("conditional-global-properties-changed",{globalProperties:t})}checkMandatoryHandlesChanged(e,t){const n=[],i=[],a=[],s=tP(e);t.forEach(o=>{if(o.isMandatory()){const l=o.isMandatoryFulfilled();l?i.push(o):a.push(o);const u=s.get(o.getName());(u===void 0||u!==l)&&n.push(o)}}),this.fireEvent("global-properties-mandatory-changed",{changed:n,completed:i,remaining:a})}fireEvent(e,t){this.eventEmitter.emit(e,t)}getShareActions(){return this.shareActions}getWorkflowViewerLink(){return this.workflowViewerLink}getWorkflowViewerAmendLink(){return this.workflowViewerAmendLink}async approve(e,t){await Le.getShadowGraphqlClient().mutate({mutation:X9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.id,note:e,stakeholderId:t}})}async reject(e,t){await Le.getShadowGraphqlClient().mutate({mutation:J9,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:this.id,note:e,stakeholderId:t}})}getQuoteCompleteMessage(){return{bundleId:this.id,bundleOwnerId:this.ownerId,quoteId:this.quoteId||""}}}const qV=Ce`
|
|
2896
2899
|
mutation processFlowCreate($processFlowId: String!, $inputs: [String]!) {
|
|
2897
2900
|
processExecutionCreate(processFlowId: $processFlowId, inputs: $inputs) {
|
|
2898
2901
|
id
|
|
2899
2902
|
}
|
|
2900
2903
|
}
|
|
2901
|
-
`;class nP{async execute(e,t,n){const a=(await Le.getShadowGraphqlClient().mutate({mutation:
|
|
2904
|
+
`;class nP{async execute(e,t,n){const a=(await Le.getShadowGraphqlClient().mutate({mutation:qV,variables:{processFlowId:e,inputs:[...t.map(f=>f.getValueForTransmission())]}})).data?.processExecutionCreate?.id;if(!a)throw new Error("Failed to create process execution.");function s(f){return new Promise(d=>{setTimeout(d,f)})}let o=!1,l=0,u,c;for(;!o;){u=await Le.getShadowGraphqlClient().query({query:Ce`
|
|
2902
2905
|
query getProcessFlowExecution($ids: [String]!) {
|
|
2903
2906
|
processExecutions(ids: $ids) {
|
|
2904
2907
|
id
|
|
@@ -2911,7 +2914,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2911
2914
|
}
|
|
2912
2915
|
}
|
|
2913
2916
|
}
|
|
2914
|
-
`,variables:{ids:[a]}});const f=u.data?.processExecutions[0];if(!u||!f)throw new Error("Failed to retrieve server response for execution.");if(f.failedAt)throw new Error("Execution has failed to complete. See Automation > FLows in Flight on partner account on SpiffCommerce Hub.");if(f.completedAt){o=!0,c=new iP(f);break}l+=1;const d=n?.repeats?n?.repeats:5;if(l>=d)throw new Error("Maximum wait time exceeded for execution result.");await s(n?.sleepTime?Math.max(n.sleepTime,500):2e3)}if(!c)throw new Error("Failed to retrieve server response for execution.");return Promise.resolve(c)}}class iP{constructor(e){this.execution=e}getRaw(){return this.execution}getNodes(){return this.execution.nodes.map(e=>new Gd(e))}getNodesByType(e){return this.execution.nodes.filter(t=>t.type===e).map(t=>new Gd(t))}getInputs(){return this.execution.nodes.filter(e=>e.type==="StartTerminal").map(e=>new Gd(e))}getOutputs(){return this.execution.nodes.filter(e=>e.type==="EndTerminal").map(e=>new Gd(e))}getCompletedAt(){if(this.execution.completedAt)return new Date(this.execution.completedAt)}getFailedAt(){if(this.execution.failedAt)return new Date(this.execution.failedAt)}}class Gd{constructor(e){this.node=e}getId(){return this.node.id}getType(){return this.node.type}getArtifacts(){return new Map(Object.entries(JSON.parse(this.node.artifacts).value))}getArtifactByName(e){return this.getArtifacts().get(e)}}class Y1{constructor(e){this.value=e}getRaw(){return this.value}getValueForTransmission(){const e=this.value;return e.startsWith("[")?JSON.stringify(JSON.parse(e)):e}}var aP=(r=>(r.Transaction="Transaction",r.Bundle="Bundle",r.Product="Product",r.Variant="Variant",r.Option="Option",r.LineItem="LineItem",r.Asset="Asset",r))(aP||{});class
|
|
2917
|
+
`,variables:{ids:[a]}});const f=u.data?.processExecutions[0];if(!u||!f)throw new Error("Failed to retrieve server response for execution.");if(f.failedAt)throw new Error("Execution has failed to complete. See Automation > FLows in Flight on partner account on SpiffCommerce Hub.");if(f.completedAt){o=!0,c=new iP(f);break}l+=1;const d=n?.repeats?n?.repeats:5;if(l>=d)throw new Error("Maximum wait time exceeded for execution result.");await s(n?.sleepTime?Math.max(n.sleepTime,500):2e3)}if(!c)throw new Error("Failed to retrieve server response for execution.");return Promise.resolve(c)}}class iP{constructor(e){this.execution=e}getRaw(){return this.execution}getNodes(){return this.execution.nodes.map(e=>new Gd(e))}getNodesByType(e){return this.execution.nodes.filter(t=>t.type===e).map(t=>new Gd(t))}getInputs(){return this.execution.nodes.filter(e=>e.type==="StartTerminal").map(e=>new Gd(e))}getOutputs(){return this.execution.nodes.filter(e=>e.type==="EndTerminal").map(e=>new Gd(e))}getCompletedAt(){if(this.execution.completedAt)return new Date(this.execution.completedAt)}getFailedAt(){if(this.execution.failedAt)return new Date(this.execution.failedAt)}}class Gd{constructor(e){this.node=e}getId(){return this.node.id}getType(){return this.node.type}getArtifacts(){return new Map(Object.entries(JSON.parse(this.node.artifacts).value))}getArtifactByName(e){return this.getArtifacts().get(e)}}class Y1{constructor(e){this.value=e}getRaw(){return this.value}getValueForTransmission(){const e=this.value;return e.startsWith("[")?JSON.stringify(JSON.parse(e)):e}}var aP=(r=>(r.Transaction="Transaction",r.Bundle="Bundle",r.Product="Product",r.Variant="Variant",r.Option="Option",r.LineItem="LineItem",r.Asset="Asset",r))(aP||{});class WV extends Y1{constructor(e){super(`"${e}"`)}}class X1 extends Y1{constructor(e,t){if(t!=="Asset"&&!X1.validUUID(e))throw new Error("Invalid ID, must be a valid v4 UUID. https://www.uuidgenerator.net/");super(`{"isSpiffObject": true, "id": "${e}", "type": "${t}"}`)}static validUUID(e){return e.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)}}class QV extends Y1{constructor(e){super(`[${e.map(t=>t.getRaw()).join(",")}]`)}}class EA{constructor(e){this.integrationProduct=e}getId(){return this.integrationProduct.id}getResource(){return this.integrationProduct}getBasePrice(){if(!this.integrationProduct.product)throw new Error("IntegrationProductResource does not have a product");const e=this.integrationProduct.product.basePrice||0,t=this.integrationProduct?.additionalIntegrationProduct;if(!t)return e;if(t&&!t.product)throw new Error("An additional integration product was found, but it does not have a product");return e+(t.product.basePrice||0)}getDefaultWorkflow(){if(!this.integrationProduct.product)throw new Error("IntegrationProductResource does not have a product");const e=this.integrationProduct.product.workflows||[];if(e.length===0)throw new Error("No workflows found on product. This is generally due to a configuration error. Please confirm at least one workflow is configured for this product.");return new co(e[0])}getAllWorkflows(){if(!this.integrationProduct.product)throw new Error("IntegrationProductResource does not have a product");const e=this.integrationProduct.product.workflows||[];if(e.length===0)throw new Error("No workflows found on product. This is generally due to a configuration error. Please confirm at least one workflow is configured for this product.");return e.sort((t,n)=>(t.index??0)-(n.index??0)).map(t=>new co(t))}}const Ly=Ce`
|
|
2915
2918
|
query GetCustomer($emailAddress: String!) {
|
|
2916
2919
|
customer(emailAddress: $emailAddress) {
|
|
2917
2920
|
id
|
|
@@ -2932,7 +2935,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2932
2935
|
}
|
|
2933
2936
|
}
|
|
2934
2937
|
}
|
|
2935
|
-
`,
|
|
2938
|
+
`,YV=Ce`
|
|
2936
2939
|
mutation CustomerCreate($details: CustomerDetailsInput!) {
|
|
2937
2940
|
customerCreate(details: $details) {
|
|
2938
2941
|
id
|
|
@@ -2981,11 +2984,11 @@ Minimum version required to store current data is: `+U+`.
|
|
|
2981
2984
|
}
|
|
2982
2985
|
}
|
|
2983
2986
|
}
|
|
2984
|
-
`;const
|
|
2987
|
+
`;const XV=Ce`
|
|
2985
2988
|
mutation CustomerGenerateVerificationCode($emailAddress: String!) {
|
|
2986
2989
|
customerGenerateVerificationCode(emailAddress: $emailAddress)
|
|
2987
2990
|
}
|
|
2988
|
-
`,
|
|
2991
|
+
`,JV=Ce`
|
|
2989
2992
|
mutation CustomerVerifyCode($emailAddress: String!, $verificationCode: String!) {
|
|
2990
2993
|
customerVerifyCode(emailAddress: $emailAddress, verificationCode: $verificationCode) {
|
|
2991
2994
|
id
|
|
@@ -3025,7 +3028,7 @@ Minimum version required to store current data is: `+U+`.
|
|
|
3025
3028
|
}
|
|
3026
3029
|
}
|
|
3027
3030
|
}
|
|
3028
|
-
`,
|
|
3031
|
+
`,KV=Ce`
|
|
3029
3032
|
query CustomerMetafields($id: String!) {
|
|
3030
3033
|
metafields(entityId: $id) {
|
|
3031
3034
|
id
|
|
@@ -3043,13 +3046,13 @@ Minimum version required to store current data is: `+U+`.
|
|
|
3043
3046
|
}
|
|
3044
3047
|
}
|
|
3045
3048
|
}
|
|
3046
|
-
`;class
|
|
3047
|
-
`+d}catch{!t.logger||t.logger?.constructor?.name==="NoOpLogger"?console.warn(d):t.logger?.warn?.(d)}typeof f.$responseBodyText<"u"&&f.$response&&(f.$response.body=f.$responseBodyText);try{if(oc.isInstance(i)){const{headers:h={},statusCode:g}=i,y=Object.entries(h);f.$metadata={httpStatusCode:g,requestId:Uy(/^x-[\w-]+-request-?id$/,y),extendedRequestId:Uy(/^x-[\w-]+-id-2$/,y),cfId:Uy(/^x-[\w-]+-cf-id$/,y)}}}catch{}}throw f}},Uy=(r,e)=>(e.find(([t])=>t.match(r))||[void 0,void 0])[1],o$=r=>(e,t)=>async n=>{const{operationSchema:i}=Ac(t),[,a,s,o,l,u]=i??[],c=t.endpointV2?async()=>J1(t.endpointV2):r.endpoint,f=await r.protocol.serializeRequest(sP(a,s,o,l,u),n.input,{...r,...t,endpoint:c});return e({...n,request:f})},l$={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},u$={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function c$(r){return{applyToStack:e=>{e.add(o$(r),u$),e.add(s$(r),l$),r.protocol.setSerdeContext(r)}}}const Vy=[];function jd(r){if(typeof r=="object")return r;if(r=r|0,Vy[r])return Vy[r];const e={};let t=0;for(const n of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(r>>t++&1)===1&&(e[n]=1);return Vy[r]=e}const Fd={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},$y=[],zy={};class yi{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=yi.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;const n=[];let i=e,a=e;for(this._isMemberSchema=!1;Hy(i);)n.push(i[1]),i=i[0],a=tg(i),this._isMemberSchema=!0;if(n.length>0){this.memberTraits={};for(let s=n.length-1;s>=0;--s){const o=n[s];Object.assign(this.memberTraits,jd(o))}}else this.memberTraits=0;if(a instanceof yi){const s=this.memberTraits;Object.assign(this,a),this.memberTraits=Object.assign({},s,a.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=t??a.memberName;return}if(this.schema=tg(a),d$(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(a),this.traits=0),this._isMemberSchema&&!t)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){const t=this.prototype.isPrototypeOf(e);return!t&&typeof e=="object"&&e!==null?e.symbol===this.symbol:t}static of(e){const t=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if($y[e])return $y[e]}else if(typeof e=="string"){if(zy[e])return zy[e]}else if(t&&e[Fd.ns])return e[Fd.ns];const n=tg(e);if(n instanceof yi)return n;if(Hy(n)){const[a,s]=n;if(a instanceof yi)return Object.assign(a.getMergedTraits(),jd(s)),a;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}const i=new yi(n);return t?e[Fd.ns]=i:typeof n=="string"?zy[n]=i:typeof n=="number"?$y[n]=i:i}getSchema(){const e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){const{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){const e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){const e=this.getSchema();if(typeof e!="object")return!1;const t=e[0];return t===3||t===-3||t===4}isUnionSchema(){const e=this.getSchema();return typeof e!="object"?!1:e[0]===4}isBlobSchema(){const e=this.getSchema();return e===21||e===42}isTimestampSchema(){const e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){const{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return jd(this.memberTraits)}getOwnTraits(){return jd(this.traits)}getKeySchema(){const[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);const n=this.getSchema(),i=e?15:n[4]??0;return Id([i,0],"key")}getValueSchema(){const e=this.getSchema(),[t,n,i]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],a=typeof e=="number"?63&e:e&&typeof e=="object"&&(n||i)?e[3+e[0]]:t?15:void 0;if(a!=null)return Id([a,0],n?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){const t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){const n=t[4].indexOf(e),i=t[5][n];return Id(Hy(i)?i:[i,0],e)}if(this.isDocumentSchema())return Id([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){const e={};try{for(const[t,n]of this.structIterator())e[t]=n}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(const[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");const e=this.getSchema(),t=e[4].length;let n=e[Fd.it];if(n&&t===n.length){yield*n;return}n=Array(t);for(let i=0;i<t;++i){const a=e[4][i],s=Id([e[5][i],0],a);yield n[i]=[a,s]}e[Fd.it]=n}}function Id(r,e){if(r instanceof yi)return Object.assign(r,{memberName:e,_isMemberSchema:!0});const t=yi;return new t(r,e)}const Hy=r=>Array.isArray(r)&&r.length===2,d$=r=>Array.isArray(r)&&r.length>=5;class ta{namespace;schemas;exceptions;static registries=new Map;constructor(e,t=new Map,n=new Map){this.namespace=e,this.schemas=t,this.exceptions=n}static for(e){return ta.registries.has(e)||ta.registries.set(e,new ta(e)),ta.registries.get(e)}copyFrom(e){const{schemas:t,exceptions:n}=this;for(const[i,a]of e.schemas)t.has(i)||t.set(i,a);for(const[i,a]of e.exceptions)n.has(i)||n.set(i,a)}register(e,t){const n=this.normalizeShapeId(e);for(const i of[this,ta.for(n.split("#")[0])])i.schemas.set(n,t)}getSchema(e){const t=this.normalizeShapeId(e);if(!this.schemas.has(t)){if(!e.includes("#")){const n="#"+e,i=[];for(const[a,s]of this.schemas.entries())a.endsWith(n)&&i.push(s);if(i.length===1)return i[0]}throw new Error(`@smithy/core/schema - schema not found for ${t}`)}return this.schemas.get(t)}registerError(e,t){const n=e,i=n[1];for(const a of[this,ta.for(i)])a.schemas.set(i+"#"+n[2],n),a.exceptions.set(n,t)}getErrorCtor(e){const t=e;return this.exceptions.has(t)?this.exceptions.get(t):ta.for(t[1]).exceptions.get(t)}getBaseException(){for(const e of this.exceptions.keys())if(Array.isArray(e)){const[,t,n]=e,i=t+"#"+n;if(i.startsWith("smithy.ts.sdk.synthetic.")&&i.endsWith("ServiceException"))return e}}find(e){for(const t of this.schemas.values())if(e(t))return t}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}const Gy="***SensitiveInformation***";function TA(r,e){if(e==null)return e;const t=yi.of(r);if(t.getMergedTraits().sensitive)return Gy;if(t.isListSchema()){if(!!t.getValueSchema().getMergedTraits().sensitive)return Gy}else if(t.isMapSchema()){if(!!t.getKeySchema().getMergedTraits().sensitive||!!t.getValueSchema().getMergedTraits().sensitive)return Gy}else if(t.isStructSchema()&&typeof e=="object"){const n=e,i={};for(const[a,s]of t.structIterator())n[a]!=null&&(i[a]=TA(s,n[a]));return i}return e}class K1{middlewareStack=Eg();schema;static classBuilder(){return new f$}resolveMiddlewareWithContext(e,t,n,{middlewareFn:i,clientName:a,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,smithyContext:u,additionalContext:c,CommandCtor:f}){for(const A of i.bind(this)(f,e,t,n))this.middlewareStack.use(A);const d=e.concat(this.middlewareStack),{logger:h}=t,g={logger:h,clientName:a,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,[kA]:{commandInstance:this,...u},...c},{requestHandler:y}=t;let v=n??{};return u.eventStream&&(v={isEventStream:!0,...v}),d.resolve(A=>y.handle(A.request,v),g)}}class f${_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=n=>n,t=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let t;return t=class extends K1{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.input=n??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(n,i,a){const s=e._operationSchema,o=s?.[4]??s?.input,l=s?.[5]??s?.output;return this.resolveMiddlewareWithContext(n,i,a,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(s?TA.bind(null,o):u=>u),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(s?TA.bind(null,l):u=>u),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}class $u extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;const t=e;return $u.prototype.isPrototypeOf(t)||!!t.$fault&&!!t.$metadata&&(t.$fault==="client"||t.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;const t=e;return this===$u?$u.isInstance(e):$u.isInstance(e)?t.name&&this.name?this.prototype.isPrototypeOf(e)||t.name===this.name:this.prototype.isPrototypeOf(e):!1}}const qE=(r,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,i])=>{(r[n]==null||r[n]==="")&&(r[n]=i)});const t=r.message||r.Message||"UnknownError";return r.message=t,delete r.Message,r},h$=r=>{switch(r){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},oP=Object.values(Ff),p$=r=>{const e=[];for(const t in Ff){const n=Ff[t];r[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>r[n]})}for(const[t,n]of Object.entries(r.checksumAlgorithms??{}))e.push({algorithmId:()=>t,checksumConstructor:()=>n});return{addChecksumAlgorithm(t){r.checksumAlgorithms=r.checksumAlgorithms??{};const n=t.algorithmId(),i=t.checksumConstructor();oP.includes(n)?r.checksumAlgorithms[n.toUpperCase()]=i:r.checksumAlgorithms[n]=i,e.push(t)},checksumAlgorithms(){return e}}},g$=r=>{const e={};return r.checksumAlgorithms().forEach(t=>{const n=t.algorithmId();oP.includes(n)&&(e[n]=t.checksumConstructor())}),e},m$=r=>({setRetryStrategy(e){r.retryStrategy=e},retryStrategy(){return r.retryStrategy}}),y$=r=>{const e={};return e.retryStrategy=r.retryStrategy(),e},v$=r=>Object.assign(p$(r),m$(r)),A$=r=>Object.assign(g$(r),y$(r));class lP{trace(){}debug(){}info(){}warn(){}error(){}}const uP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",WE=Object.entries(uP).reduce((r,[e,t])=>(r[t]=Number(e),r),{}),b$=uP.split(""),Qu=6,rf=8,w$=63,im=r=>{let e=r.length/4*3;r.slice(-2)==="=="?e-=2:r.slice(-1)==="="&&e--;const t=new ArrayBuffer(e),n=new DataView(t);for(let i=0;i<r.length;i+=4){let a=0,s=0;for(let u=i,c=i+3;u<=c;u++)if(r[u]!=="="){if(!(r[u]in WE))throw new TypeError(`Invalid character ${r[u]} in base64 string.`);a|=WE[r[u]]<<(c-u)*Qu,s+=Qu}else a>>=Qu;const o=i/4*3;a>>=s%rf;const l=Math.floor(s/rf);for(let u=0;u<l;u++){const c=(l-u-1)*rf;n.setUint8(o+u,(a&255<<c)>>c)}}return new Uint8Array(t)},Pl=r=>new TextEncoder().encode(r);function Tg(r){let e;typeof r=="string"?e=Pl(r):e=r;const t=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!t&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let i="";for(let a=0;a<e.length;a+=3){let s=0,o=0;for(let u=a,c=Math.min(a+3,e.length);u<c;u++)s|=e[u]<<(c-u-1)*rf,o+=rf;const l=Math.ceil(o/Qu);s<<=l*Qu-o;for(let u=1;u<=l;u++){const c=(l-u)*Qu;i+=b$[(s&w$<<c)>>c]}i+="==".slice(0,4-l)}return i}function x$(r,e,t,n){return class rg extends Uint8Array{static fromString(a,s="utf-8"){if(typeof a=="string")return s==="base64"?rg.mutate(n(a)):rg.mutate(e(a));throw new Error(`Unsupported conversion from ${typeof a} to Uint8ArrayBlobAdapter.`)}static mutate(a){return Object.setPrototypeOf(a,rg.prototype),a}transformToString(a="utf-8"){return a==="base64"?t(this):r(this)}}}const am=r=>{if(typeof r=="string")return r;if(typeof r!="object"||typeof r.byteOffset!="number"||typeof r.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(r)},Pi=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function C$(r){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?()=>crypto.randomUUID():()=>{const e=new Uint8Array(16);return r(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,Pi[e[0]]+Pi[e[1]]+Pi[e[2]]+Pi[e[3]]+"-"+Pi[e[4]]+Pi[e[5]]+"-"+Pi[e[6]]+Pi[e[7]]+"-"+Pi[e[8]]+Pi[e[9]]+"-"+Pi[e[10]]+Pi[e[11]]+Pi[e[12]]+Pi[e[13]]+Pi[e[14]]+Pi[e[15]]}}const FA=r=>{if(r!=null){if(typeof r=="string"){const e=parseFloat(r);if(!Number.isNaN(e))return String(e)!==String(r)&&R$.warn(D$(`Expected number but observed string: ${r}`)),e}if(typeof r=="number")return r;throw new TypeError(`Expected number, got ${typeof r}: ${r}`)}},S$=Math.ceil(2**127*(2-2**-23)),QE=r=>{const e=FA(r);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>S$)throw new TypeError(`Expected 32-bit float, got ${r}`);return e},E$=r=>{if(r!=null){if(Number.isInteger(r)&&!Number.isNaN(r))return r;throw new TypeError(`Expected integer, got ${typeof r}: ${r}`)}},YE=r=>cP(r,16),XE=r=>cP(r,8),cP=(r,e)=>{const t=E$(r);if(t!==void 0&&k$(t,e)!==t)throw new TypeError(`Expected ${e}-bit integer, got ${r}`);return t},k$=(r,e)=>{switch(e){case 32:return Int32Array.of(r)[0];case 16:return Int16Array.of(r)[0];case 8:return Int8Array.of(r)[0]}},T$=r=>FA(typeof r=="string"?sm(r):r),F$=r=>QE(typeof r=="string"?sm(r):r),I$=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,sm=r=>{const e=r.match(I$);if(e===null||e[0].length!==r.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(r)},Fg=r=>YE(typeof r=="string"?sm(r):r),P$=r=>XE(typeof r=="string"?sm(r):r),D$=r=>String(new TypeError(r).stack||r).split(`
|
|
3049
|
+
`;class ZV{constructor(e,t=Le.getShadowGraphqlClient.bind(Le)){this.options=e,this.client=t}query(e){const t=this.options?.onQuery?this.options?.onQuery(e):{};return this.client().query({...t,...e,context:{...t.context??{},...e.context??{}}})}mutate(e){const t=this.options?.onMutate?this.options?.onMutate(e):{};return this.client().mutate({...t,...e,context:{...t.context??{},...e.context??{}}})}}function e$(r,e,t){return r.$source||(r.$source={}),r.$source[e]=t,r}const t$=r=>r?.body instanceof ReadableStream,ml=(r,e)=>{const t=[];if(r&&t.push(r),e)for(const n of e)t.push(n);return t},no=(r,e)=>`${r||"anonymous"}${e&&e.length>0?` (a.k.a. ${e.join(",")})`:""}`,Eg=()=>{let r=[],e=[],t=!1;const n=new Set,i=f=>f.sort((d,h)=>GE[h.step]-GE[d.step]||jE[h.priority||"normal"]-jE[d.priority||"normal"]),a=f=>{let d=!1;const h=g=>{const y=ml(g.name,g.aliases);if(y.includes(f)){d=!0;for(const v of y)n.delete(v);return!1}return!0};return r=r.filter(h),e=e.filter(h),d},s=f=>{let d=!1;const h=g=>{if(g.middleware===f){d=!0;for(const y of ml(g.name,g.aliases))n.delete(y);return!1}return!0};return r=r.filter(h),e=e.filter(h),d},o=f=>(r.forEach(d=>{f.add(d.middleware,{...d})}),e.forEach(d=>{f.addRelativeTo(d.middleware,{...d})}),f.identifyOnResolve?.(c.identifyOnResolve()),f),l=f=>{const d=[];return f.before.forEach(h=>{h.before.length===0&&h.after.length===0?d.push(h):d.push(...l(h))}),d.push(f),f.after.reverse().forEach(h=>{h.before.length===0&&h.after.length===0?d.push(h):d.push(...l(h))}),d},u=(f=!1)=>{const d=[],h=[],g={};return r.forEach(v=>{const A={...v,before:[],after:[]};for(const x of ml(A.name,A.aliases))g[x]=A;d.push(A)}),e.forEach(v=>{const A={...v,before:[],after:[]};for(const x of ml(A.name,A.aliases))g[x]=A;h.push(A)}),h.forEach(v=>{if(v.toMiddleware){const A=g[v.toMiddleware];if(A===void 0){if(f)return;throw new Error(`${v.toMiddleware} is not found when adding ${no(v.name,v.aliases)} middleware ${v.relation} ${v.toMiddleware}`)}v.relation==="after"&&A.after.push(v),v.relation==="before"&&A.before.push(v)}}),i(d).map(l).reduce((v,A)=>(v.push(...A),v),[])},c={add:(f,d={})=>{const{name:h,override:g,aliases:y}=d,v={step:"initialize",priority:"normal",middleware:f,...d},A=ml(h,y);if(A.length>0){if(A.some(x=>n.has(x))){if(!g)throw new Error(`Duplicate middleware name '${no(h,y)}'`);for(const x of A){const S=r.findIndex(E=>E.name===x||E.aliases?.some(R=>R===x));if(S===-1)continue;const F=r[S];if(F.step!==v.step||v.priority!==F.priority)throw new Error(`"${no(F.name,F.aliases)}" middleware with ${F.priority} priority in ${F.step} step cannot be overridden by "${no(h,y)}" middleware with ${v.priority} priority in ${v.step} step.`);r.splice(S,1)}}for(const x of A)n.add(x)}r.push(v)},addRelativeTo:(f,d)=>{const{name:h,override:g,aliases:y}=d,v={middleware:f,...d},A=ml(h,y);if(A.length>0){if(A.some(x=>n.has(x))){if(!g)throw new Error(`Duplicate middleware name '${no(h,y)}'`);for(const x of A){const S=e.findIndex(E=>E.name===x||E.aliases?.some(R=>R===x));if(S===-1)continue;const F=e[S];if(F.toMiddleware!==v.toMiddleware||F.relation!==v.relation)throw new Error(`"${no(F.name,F.aliases)}" middleware ${F.relation} "${F.toMiddleware}" middleware cannot be overridden by "${no(h,y)}" middleware ${v.relation} "${v.toMiddleware}" middleware.`);e.splice(S,1)}}for(const x of A)n.add(x)}e.push(v)},clone:()=>o(Eg()),use:f=>{f.applyToStack(c)},remove:f=>typeof f=="string"?a(f):s(f),removeByTag:f=>{let d=!1;const h=g=>{const{tags:y,name:v,aliases:A}=g;if(y&&y.includes(f)){const x=ml(v,A);for(const S of x)n.delete(S);return d=!0,!1}return!0};return r=r.filter(h),e=e.filter(h),d},concat:f=>{const d=o(Eg());return d.use(f),d.identifyOnResolve(t||d.identifyOnResolve()||(f.identifyOnResolve?.()??!1)),d},applyToStack:o,identify:()=>u(!0).map(f=>{const d=f.step??f.relation+" "+f.toMiddleware;return no(f.name,f.aliases)+" - "+d}),identifyOnResolve(f){return typeof f=="boolean"&&(t=f),t},resolve:(f,d)=>{for(const h of u().map(g=>g.middleware).reverse())f=h(f,d);return t&&console.log(c.identify()),f}};return c},GE={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},jE={high:3,normal:2,low:1};var Tf;(function(r){r.HTTP="http",r.HTTPS="https"})(Tf||(Tf={}));var Ff;(function(r){r.MD5="md5",r.CRC32="crc32",r.CRC32C="crc32c",r.SHA1="sha1",r.SHA256="sha256"})(Ff||(Ff={}));const kA="__smithy_context",Ac=r=>r[kA]||(r[kA]={});class aa{method;protocol;hostname;port;path;query;headers;username;password;fragment;body;constructor(e){this.method=e.method||"GET",this.hostname=e.hostname||"localhost",this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)!==":"?`${e.protocol}:`:e.protocol:"https:",this.path=e.path?e.path.charAt(0)!=="/"?`/${e.path}`:e.path:"/",this.username=e.username,this.password=e.password,this.fragment=e.fragment}static clone(e){const t=new aa({...e,headers:{...e.headers}});return t.query&&(t.query=r$(t.query)),t}static isInstance(e){if(!e)return!1;const t=e;return"method"in t&&"protocol"in t&&"hostname"in t&&"path"in t&&typeof t.query=="object"&&typeof t.headers=="object"}clone(){return aa.clone(this)}}function r$(r){return Object.keys(r).reduce((e,t)=>{const n=r[t];return{...e,[t]:Array.isArray(n)?[...n]:n}},{})}class oc{statusCode;reason;headers;body;constructor(e){this.statusCode=e.statusCode,this.reason=e.reason,this.headers=e.headers||{},this.body=e.body}static isInstance(e){if(!e)return!1;const t=e;return typeof t.statusCode=="number"&&typeof t.headers=="object"}}const n$=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),nm=(r,e=!1)=>{if(!e)return n$.test(r);const t=r.split(".");for(const n of t)if(!nm(n))return!1;return!0},_s=r=>{if(typeof r=="function")return r;const e=Promise.resolve(r);return()=>e};function i$(r){const e={};if(r=r.replace(/^\?/,""),r)for(const t of r.split("&")){let[n,i=null]=t.split("=");n=decodeURIComponent(n),i&&(i=decodeURIComponent(i)),n in e?Array.isArray(e[n])?e[n].push(i):e[n]=[e[n],i]:e[n]=i}return e}const kg=r=>{if(typeof r=="string")return kg(new URL(r));const{hostname:e,pathname:t,port:n,protocol:i,search:a}=r;let s;return a&&(s=i$(a)),{hostname:e,port:n?parseInt(n):void 0,protocol:i,path:t,query:s}},J1=r=>{if(typeof r=="object"){if("url"in r){const e=kg(r.url);if(r.headers){e.headers={};for(const t in r.headers)e.headers[t.toLowerCase()]=r.headers[t].join(", ")}return e}return r}return kg(r)},a$=r=>()=>Promise.reject(r);class s${config;middlewareStack=Eg();initConfig;handlers;constructor(e){this.config=e;const{protocol:t,protocolSettings:n}=e;n&&typeof t=="function"&&(e.protocol=new t(n))}send(e,t,n){const i=typeof t!="function"?t:void 0,a=typeof t=="function"?t:n,s=i===void 0&&this.config.cacheMiddleware===!0;let o;if(s){this.handlers||(this.handlers=new WeakMap);const l=this.handlers;l.has(e.constructor)?o=l.get(e.constructor):(o=e.resolveMiddleware(this.middlewareStack,this.config,i),l.set(e.constructor,o))}else delete this.handlers,o=e.resolveMiddleware(this.middlewareStack,this.config,i);if(a)o(e).then(l=>a(null,l.output),l=>a(l)).catch(()=>{});else return o(e).then(l=>l.output)}destroy(){this.config?.requestHandler?.destroy?.(),delete this.handlers}}const tg=r=>typeof r=="function"?r():r,sP=(r,e,t,n,i)=>({name:e,namespace:r,traits:t,input:n,output:i}),o$=r=>(e,t)=>async n=>{const{response:i}=await e(n),{operationSchema:a}=Ac(t),[,s,o,l,u,c]=a??[];try{const f=await r.protocol.deserializeResponse(sP(s,o,l,u,c),{...r,...t},i);return{response:i,output:f}}catch(f){if(Object.defineProperty(f,"$response",{value:i,enumerable:!1,writable:!1,configurable:!1}),!("$metadata"in f)){const d="Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.";try{f.message+=`
|
|
3050
|
+
`+d}catch{!t.logger||t.logger?.constructor?.name==="NoOpLogger"?console.warn(d):t.logger?.warn?.(d)}typeof f.$responseBodyText<"u"&&f.$response&&(f.$response.body=f.$responseBodyText);try{if(oc.isInstance(i)){const{headers:h={},statusCode:g}=i,y=Object.entries(h);f.$metadata={httpStatusCode:g,requestId:Uy(/^x-[\w-]+-request-?id$/,y),extendedRequestId:Uy(/^x-[\w-]+-id-2$/,y),cfId:Uy(/^x-[\w-]+-cf-id$/,y)}}}catch{}}throw f}},Uy=(r,e)=>(e.find(([t])=>t.match(r))||[void 0,void 0])[1],l$=r=>(e,t)=>async n=>{const{operationSchema:i}=Ac(t),[,a,s,o,l,u]=i??[],c=t.endpointV2?async()=>J1(t.endpointV2):r.endpoint,f=await r.protocol.serializeRequest(sP(a,s,o,l,u),n.input,{...r,...t,endpoint:c});return e({...n,request:f})},u$={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},c$={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};function d$(r){return{applyToStack:e=>{e.add(l$(r),c$),e.add(o$(r),u$),r.protocol.setSerdeContext(r)}}}const Vy=[];function jd(r){if(typeof r=="object")return r;if(r=r|0,Vy[r])return Vy[r];const e={};let t=0;for(const n of["httpLabel","idempotent","idempotencyToken","sensitive","httpPayload","httpResponseCode","httpQueryParams"])(r>>t++&1)===1&&(e[n]=1);return Vy[r]=e}const Fd={it:Symbol.for("@smithy/nor-struct-it"),ns:Symbol.for("@smithy/ns")},$y=[],zy={};class yi{ref;memberName;static symbol=Symbol.for("@smithy/nor");symbol=yi.symbol;name;schema;_isMemberSchema;traits;memberTraits;normalizedTraits;constructor(e,t){this.ref=e,this.memberName=t;const n=[];let i=e,a=e;for(this._isMemberSchema=!1;Hy(i);)n.push(i[1]),i=i[0],a=tg(i),this._isMemberSchema=!0;if(n.length>0){this.memberTraits={};for(let s=n.length-1;s>=0;--s){const o=n[s];Object.assign(this.memberTraits,jd(o))}}else this.memberTraits=0;if(a instanceof yi){const s=this.memberTraits;Object.assign(this,a),this.memberTraits=Object.assign({},s,a.getMemberTraits(),this.getMemberTraits()),this.normalizedTraits=void 0,this.memberName=t??a.memberName;return}if(this.schema=tg(a),f$(this.schema)?(this.name=`${this.schema[1]}#${this.schema[2]}`,this.traits=this.schema[3]):(this.name=this.memberName??String(a),this.traits=0),this._isMemberSchema&&!t)throw new Error(`@smithy/core/schema - NormalizedSchema member init ${this.getName(!0)} missing member name.`)}static[Symbol.hasInstance](e){const t=this.prototype.isPrototypeOf(e);return!t&&typeof e=="object"&&e!==null?e.symbol===this.symbol:t}static of(e){const t=typeof e=="function"||typeof e=="object"&&e!==null;if(typeof e=="number"){if($y[e])return $y[e]}else if(typeof e=="string"){if(zy[e])return zy[e]}else if(t&&e[Fd.ns])return e[Fd.ns];const n=tg(e);if(n instanceof yi)return n;if(Hy(n)){const[a,s]=n;if(a instanceof yi)return Object.assign(a.getMergedTraits(),jd(s)),a;throw new Error(`@smithy/core/schema - may not init unwrapped member schema=${JSON.stringify(e,null,2)}.`)}const i=new yi(n);return t?e[Fd.ns]=i:typeof n=="string"?zy[n]=i:typeof n=="number"?$y[n]=i:i}getSchema(){const e=this.schema;return Array.isArray(e)&&e[0]===0?e[4]:e}getName(e=!1){const{name:t}=this;return!e&&t&&t.includes("#")?t.split("#")[1]:t||void 0}getMemberName(){return this.memberName}isMemberSchema(){return this._isMemberSchema}isListSchema(){const e=this.getSchema();return typeof e=="number"?e>=64&&e<128:e[0]===1}isMapSchema(){const e=this.getSchema();return typeof e=="number"?e>=128&&e<=255:e[0]===2}isStructSchema(){const e=this.getSchema();if(typeof e!="object")return!1;const t=e[0];return t===3||t===-3||t===4}isUnionSchema(){const e=this.getSchema();return typeof e!="object"?!1:e[0]===4}isBlobSchema(){const e=this.getSchema();return e===21||e===42}isTimestampSchema(){const e=this.getSchema();return typeof e=="number"&&e>=4&&e<=7}isUnitSchema(){return this.getSchema()==="unit"}isDocumentSchema(){return this.getSchema()===15}isStringSchema(){return this.getSchema()===0}isBooleanSchema(){return this.getSchema()===2}isNumericSchema(){return this.getSchema()===1}isBigIntegerSchema(){return this.getSchema()===17}isBigDecimalSchema(){return this.getSchema()===19}isStreaming(){const{streaming:e}=this.getMergedTraits();return!!e||this.getSchema()===42}isIdempotencyToken(){return!!this.getMergedTraits().idempotencyToken}getMergedTraits(){return this.normalizedTraits??(this.normalizedTraits={...this.getOwnTraits(),...this.getMemberTraits()})}getMemberTraits(){return jd(this.memberTraits)}getOwnTraits(){return jd(this.traits)}getKeySchema(){const[e,t]=[this.isDocumentSchema(),this.isMapSchema()];if(!e&&!t)throw new Error(`@smithy/core/schema - cannot get key for non-map: ${this.getName(!0)}`);const n=this.getSchema(),i=e?15:n[4]??0;return Id([i,0],"key")}getValueSchema(){const e=this.getSchema(),[t,n,i]=[this.isDocumentSchema(),this.isMapSchema(),this.isListSchema()],a=typeof e=="number"?63&e:e&&typeof e=="object"&&(n||i)?e[3+e[0]]:t?15:void 0;if(a!=null)return Id([a,0],n?"value":"member");throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no value member.`)}getMemberSchema(e){const t=this.getSchema();if(this.isStructSchema()&&t[4].includes(e)){const n=t[4].indexOf(e),i=t[5][n];return Id(Hy(i)?i:[i,0],e)}if(this.isDocumentSchema())return Id([15,0],e);throw new Error(`@smithy/core/schema - ${this.getName(!0)} has no member=${e}.`)}getMemberSchemas(){const e={};try{for(const[t,n]of this.structIterator())e[t]=n}catch{}return e}getEventStreamMember(){if(this.isStructSchema()){for(const[e,t]of this.structIterator())if(t.isStreaming()&&t.isStructSchema())return e}return""}*structIterator(){if(this.isUnitSchema())return;if(!this.isStructSchema())throw new Error("@smithy/core/schema - cannot iterate non-struct schema.");const e=this.getSchema(),t=e[4].length;let n=e[Fd.it];if(n&&t===n.length){yield*n;return}n=Array(t);for(let i=0;i<t;++i){const a=e[4][i],s=Id([e[5][i],0],a);yield n[i]=[a,s]}e[Fd.it]=n}}function Id(r,e){if(r instanceof yi)return Object.assign(r,{memberName:e,_isMemberSchema:!0});const t=yi;return new t(r,e)}const Hy=r=>Array.isArray(r)&&r.length===2,f$=r=>Array.isArray(r)&&r.length>=5;class ta{namespace;schemas;exceptions;static registries=new Map;constructor(e,t=new Map,n=new Map){this.namespace=e,this.schemas=t,this.exceptions=n}static for(e){return ta.registries.has(e)||ta.registries.set(e,new ta(e)),ta.registries.get(e)}copyFrom(e){const{schemas:t,exceptions:n}=this;for(const[i,a]of e.schemas)t.has(i)||t.set(i,a);for(const[i,a]of e.exceptions)n.has(i)||n.set(i,a)}register(e,t){const n=this.normalizeShapeId(e);for(const i of[this,ta.for(n.split("#")[0])])i.schemas.set(n,t)}getSchema(e){const t=this.normalizeShapeId(e);if(!this.schemas.has(t)){if(!e.includes("#")){const n="#"+e,i=[];for(const[a,s]of this.schemas.entries())a.endsWith(n)&&i.push(s);if(i.length===1)return i[0]}throw new Error(`@smithy/core/schema - schema not found for ${t}`)}return this.schemas.get(t)}registerError(e,t){const n=e,i=n[1];for(const a of[this,ta.for(i)])a.schemas.set(i+"#"+n[2],n),a.exceptions.set(n,t)}getErrorCtor(e){const t=e;return this.exceptions.has(t)?this.exceptions.get(t):ta.for(t[1]).exceptions.get(t)}getBaseException(){for(const e of this.exceptions.keys())if(Array.isArray(e)){const[,t,n]=e,i=t+"#"+n;if(i.startsWith("smithy.ts.sdk.synthetic.")&&i.endsWith("ServiceException"))return e}}find(e){for(const t of this.schemas.values())if(e(t))return t}clear(){this.schemas.clear(),this.exceptions.clear()}normalizeShapeId(e){return e.includes("#")?e:this.namespace+"#"+e}}const Gy="***SensitiveInformation***";function TA(r,e){if(e==null)return e;const t=yi.of(r);if(t.getMergedTraits().sensitive)return Gy;if(t.isListSchema()){if(!!t.getValueSchema().getMergedTraits().sensitive)return Gy}else if(t.isMapSchema()){if(!!t.getKeySchema().getMergedTraits().sensitive||!!t.getValueSchema().getMergedTraits().sensitive)return Gy}else if(t.isStructSchema()&&typeof e=="object"){const n=e,i={};for(const[a,s]of t.structIterator())n[a]!=null&&(i[a]=TA(s,n[a]));return i}return e}class K1{middlewareStack=Eg();schema;static classBuilder(){return new h$}resolveMiddlewareWithContext(e,t,n,{middlewareFn:i,clientName:a,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,smithyContext:u,additionalContext:c,CommandCtor:f}){for(const A of i.bind(this)(f,e,t,n))this.middlewareStack.use(A);const d=e.concat(this.middlewareStack),{logger:h}=t,g={logger:h,clientName:a,commandName:s,inputFilterSensitiveLog:o,outputFilterSensitiveLog:l,[kA]:{commandInstance:this,...u},...c},{requestHandler:y}=t;let v=n??{};return u.eventStream&&(v={isEventStream:!0,...v}),d.resolve(A=>y.handle(A.request,v),g)}}class h${_init=()=>{};_ep={};_middlewareFn=()=>[];_commandName="";_clientName="";_additionalContext={};_smithyContext={};_inputFilterSensitiveLog=void 0;_outputFilterSensitiveLog=void 0;_serializer=null;_deserializer=null;_operationSchema;init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,t,n={}){return this._smithyContext={service:e,operation:t,...n},this}c(e={}){return this._additionalContext=e,this}n(e,t){return this._clientName=e,this._commandName=t,this}f(e=n=>n,t=n=>n){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=t,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}sc(e){return this._operationSchema=e,this._smithyContext.operationSchema=e,this}build(){const e=this;let t;return t=class extends K1{input;static getEndpointParameterInstructions(){return e._ep}constructor(...[n]){super(),this.input=n??{},e._init(this),this.schema=e._operationSchema}resolveMiddleware(n,i,a){const s=e._operationSchema,o=s?.[4]??s?.input,l=s?.[5]??s?.output;return this.resolveMiddlewareWithContext(n,i,a,{CommandCtor:t,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog??(s?TA.bind(null,o):u=>u),outputFilterSensitiveLog:e._outputFilterSensitiveLog??(s?TA.bind(null,l):u=>u),smithyContext:e._smithyContext,additionalContext:e._additionalContext})}serialize=e._serializer;deserialize=e._deserializer}}}class $u extends Error{$fault;$response;$retryable;$metadata;constructor(e){super(e.message),Object.setPrototypeOf(this,Object.getPrototypeOf(this).constructor.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}static isInstance(e){if(!e)return!1;const t=e;return $u.prototype.isPrototypeOf(t)||!!t.$fault&&!!t.$metadata&&(t.$fault==="client"||t.$fault==="server")}static[Symbol.hasInstance](e){if(!e)return!1;const t=e;return this===$u?$u.isInstance(e):$u.isInstance(e)?t.name&&this.name?this.prototype.isPrototypeOf(e)||t.name===this.name:this.prototype.isPrototypeOf(e):!1}}const qE=(r,e={})=>{Object.entries(e).filter(([,n])=>n!==void 0).forEach(([n,i])=>{(r[n]==null||r[n]==="")&&(r[n]=i)});const t=r.message||r.Message||"UnknownError";return r.message=t,delete r.Message,r},p$=r=>{switch(r){case"standard":return{retryMode:"standard",connectionTimeout:3100};case"in-region":return{retryMode:"standard",connectionTimeout:1100};case"cross-region":return{retryMode:"standard",connectionTimeout:3100};case"mobile":return{retryMode:"standard",connectionTimeout:3e4};default:return{}}},oP=Object.values(Ff),g$=r=>{const e=[];for(const t in Ff){const n=Ff[t];r[n]!==void 0&&e.push({algorithmId:()=>n,checksumConstructor:()=>r[n]})}for(const[t,n]of Object.entries(r.checksumAlgorithms??{}))e.push({algorithmId:()=>t,checksumConstructor:()=>n});return{addChecksumAlgorithm(t){r.checksumAlgorithms=r.checksumAlgorithms??{};const n=t.algorithmId(),i=t.checksumConstructor();oP.includes(n)?r.checksumAlgorithms[n.toUpperCase()]=i:r.checksumAlgorithms[n]=i,e.push(t)},checksumAlgorithms(){return e}}},m$=r=>{const e={};return r.checksumAlgorithms().forEach(t=>{const n=t.algorithmId();oP.includes(n)&&(e[n]=t.checksumConstructor())}),e},y$=r=>({setRetryStrategy(e){r.retryStrategy=e},retryStrategy(){return r.retryStrategy}}),v$=r=>{const e={};return e.retryStrategy=r.retryStrategy(),e},A$=r=>Object.assign(g$(r),y$(r)),b$=r=>Object.assign(m$(r),v$(r));class lP{trace(){}debug(){}info(){}warn(){}error(){}}const uP="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",WE=Object.entries(uP).reduce((r,[e,t])=>(r[t]=Number(e),r),{}),w$=uP.split(""),Qu=6,rf=8,x$=63,im=r=>{let e=r.length/4*3;r.slice(-2)==="=="?e-=2:r.slice(-1)==="="&&e--;const t=new ArrayBuffer(e),n=new DataView(t);for(let i=0;i<r.length;i+=4){let a=0,s=0;for(let u=i,c=i+3;u<=c;u++)if(r[u]!=="="){if(!(r[u]in WE))throw new TypeError(`Invalid character ${r[u]} in base64 string.`);a|=WE[r[u]]<<(c-u)*Qu,s+=Qu}else a>>=Qu;const o=i/4*3;a>>=s%rf;const l=Math.floor(s/rf);for(let u=0;u<l;u++){const c=(l-u-1)*rf;n.setUint8(o+u,(a&255<<c)>>c)}}return new Uint8Array(t)},Pl=r=>new TextEncoder().encode(r);function Tg(r){let e;typeof r=="string"?e=Pl(r):e=r;const t=typeof e=="object"&&typeof e.length=="number",n=typeof e=="object"&&typeof e.byteOffset=="number"&&typeof e.byteLength=="number";if(!t&&!n)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let i="";for(let a=0;a<e.length;a+=3){let s=0,o=0;for(let u=a,c=Math.min(a+3,e.length);u<c;u++)s|=e[u]<<(c-u-1)*rf,o+=rf;const l=Math.ceil(o/Qu);s<<=l*Qu-o;for(let u=1;u<=l;u++){const c=(l-u)*Qu;i+=w$[(s&x$<<c)>>c]}i+="==".slice(0,4-l)}return i}function C$(r,e,t,n){return class rg extends Uint8Array{static fromString(a,s="utf-8"){if(typeof a=="string")return s==="base64"?rg.mutate(n(a)):rg.mutate(e(a));throw new Error(`Unsupported conversion from ${typeof a} to Uint8ArrayBlobAdapter.`)}static mutate(a){return Object.setPrototypeOf(a,rg.prototype),a}transformToString(a="utf-8"){return a==="base64"?t(this):r(this)}}}const am=r=>{if(typeof r=="string")return r;if(typeof r!="object"||typeof r.byteOffset!="number"||typeof r.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(r)},Pi=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function S$(r){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?()=>crypto.randomUUID():()=>{const e=new Uint8Array(16);return r(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128,Pi[e[0]]+Pi[e[1]]+Pi[e[2]]+Pi[e[3]]+"-"+Pi[e[4]]+Pi[e[5]]+"-"+Pi[e[6]]+Pi[e[7]]+"-"+Pi[e[8]]+Pi[e[9]]+"-"+Pi[e[10]]+Pi[e[11]]+Pi[e[12]]+Pi[e[13]]+Pi[e[14]]+Pi[e[15]]}}const FA=r=>{if(r!=null){if(typeof r=="string"){const e=parseFloat(r);if(!Number.isNaN(e))return String(e)!==String(r)&&O$.warn(R$(`Expected number but observed string: ${r}`)),e}if(typeof r=="number")return r;throw new TypeError(`Expected number, got ${typeof r}: ${r}`)}},E$=Math.ceil(2**127*(2-2**-23)),QE=r=>{const e=FA(r);if(e!==void 0&&!Number.isNaN(e)&&e!==1/0&&e!==-1/0&&Math.abs(e)>E$)throw new TypeError(`Expected 32-bit float, got ${r}`);return e},k$=r=>{if(r!=null){if(Number.isInteger(r)&&!Number.isNaN(r))return r;throw new TypeError(`Expected integer, got ${typeof r}: ${r}`)}},YE=r=>cP(r,16),XE=r=>cP(r,8),cP=(r,e)=>{const t=k$(r);if(t!==void 0&&T$(t,e)!==t)throw new TypeError(`Expected ${e}-bit integer, got ${r}`);return t},T$=(r,e)=>{switch(e){case 32:return Int32Array.of(r)[0];case 16:return Int16Array.of(r)[0];case 8:return Int8Array.of(r)[0]}},F$=r=>FA(typeof r=="string"?sm(r):r),I$=r=>QE(typeof r=="string"?sm(r):r),P$=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,sm=r=>{const e=r.match(P$);if(e===null||e[0].length!==r.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(r)},Fg=r=>YE(typeof r=="string"?sm(r):r),D$=r=>XE(typeof r=="string"?sm(r):r),R$=r=>String(new TypeError(r).stack||r).split(`
|
|
3048
3051
|
`).slice(0,5).filter(e=>!e.includes("stackTraceWarning")).join(`
|
|
3049
|
-
`),R$={warn:console.warn},O$=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Z1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function B$(r){const e=r.getUTCFullYear(),t=r.getUTCMonth(),n=r.getUTCDay(),i=r.getUTCDate(),a=r.getUTCHours(),s=r.getUTCMinutes(),o=r.getUTCSeconds(),l=i<10?`0${i}`:`${i}`,u=a<10?`0${a}`:`${a}`,c=s<10?`0${s}`:`${s}`,f=o<10?`0${o}`:`${o}`;return`${O$[n]}, ${l} ${Z1[t]} ${e} ${u}:${c}:${f} GMT`}const M$=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),_$=r=>{if(r==null)return;if(typeof r!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");const e=M$.exec(r);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");const[t,n,i,a,s,o,l,u,c]=e,f=Fg(If(n)),d=wo(i,"month",1,12),h=wo(a,"day",1,31),g=ng(f,d,h,{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u});return c.toUpperCase()!="Z"&&g.setTime(g.getTime()-Q$(c)),g},N$=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),L$=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),U$=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),dP=r=>{if(r==null)return;if(typeof r!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=N$.exec(r);if(e){const[t,n,i,a,s,o,l,u]=e;return ng(Fg(If(a)),jy(i),wo(n,"day",1,31),{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u})}if(e=L$.exec(r),e){const[t,n,i,a,s,o,l,u]=e;return H$(ng($$(a),jy(i),wo(n,"day",1,31),{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u}))}if(e=U$.exec(r),e){const[t,n,i,a,s,o,l,u]=e;return ng(Fg(If(u)),jy(n),wo(i.trimLeft(),"day",1,31),{hours:a,minutes:s,seconds:o,fractionalMilliseconds:l})}throw new TypeError("Invalid RFC-7231 date-time value")},V$=r=>{if(r==null)return;let e;if(typeof r=="number")e=r;else if(typeof r=="string")e=T$(r);else if(typeof r=="object"&&r.tag===1)e=r.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},ng=(r,e,t,n)=>{const i=e-1;return j$(r,i,t),new Date(Date.UTC(r,i,t,wo(n.hours,"hour",0,23),wo(n.minutes,"minute",0,59),wo(n.seconds,"seconds",0,60),W$(n.fractionalMilliseconds)))},$$=r=>{const e=new Date().getUTCFullYear(),t=Math.floor(e/100)*100+Fg(If(r));return t<e?t+100:t},z$=50*365*24*60*60*1e3,H$=r=>r.getTime()-new Date().getTime()>z$?new Date(Date.UTC(r.getUTCFullYear()-100,r.getUTCMonth(),r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds())):r,jy=r=>{const e=Z1.indexOf(r);if(e<0)throw new TypeError(`Invalid month: ${r}`);return e+1},G$=[31,28,31,30,31,30,31,31,30,31,30,31],j$=(r,e,t)=>{let n=G$[e];if(e===1&&q$(r)&&(n=29),t>n)throw new TypeError(`Invalid day for ${Z1[e]} in ${r}: ${t}`)},q$=r=>r%4===0&&(r%100!==0||r%400===0),wo=(r,e,t,n)=>{const i=P$(If(r));if(i<t||i>n)throw new TypeError(`${e} must be between ${t} and ${n}, inclusive`);return i},W$=r=>r==null?0:F$("0."+r)*1e3,Q$=r=>{const e=r[0];let t=1;if(e=="+")t=1;else if(e=="-")t=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);const n=Number(r.substring(1,3)),i=Number(r.substring(4,6));return t*(n*60+i)*60*1e3},If=r=>{let e=0;for(;e<r.length-1&&r.charAt(e)==="0";)e++;return e===0?r:r.slice(e)},yo=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};yo.from=r=>r&&typeof r=="object"&&(r instanceof yo||"deserializeJSON"in r)?r:typeof r=="string"||Object.getPrototypeOf(r)===String.prototype?yo(String(r)):yo(JSON.stringify(r));yo.fromObject=yo.from;const JE=/^-?\d*(\.\d+)?$/;class as{string;type;constructor(e,t){if(this.string=e,this.type=t,!JE.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;const t=e;return as.prototype.isPrototypeOf(e)||t.type==="bigDecimal"&&JE.test(t.string)}}const fP={},IA={};for(let r=0;r<256;r++){let e=r.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),fP[r]=e,IA[e]=r}function hP(r){if(r.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2){const n=r.slice(t,t+2).toLowerCase();if(n in IA)e[t/2]=IA[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function xo(r){let e="";for(let t=0;t<r.byteLength;t++)e+=fP[r[t]];return e}const KE=typeof TextEncoder=="function"?new TextEncoder:null,Y$=r=>{if(typeof r=="string"){if(KE)return KE.encode(r).byteLength;let e=r.length;for(let t=e-1;t>=0;t--){const n=r.charCodeAt(t);n>127&&n<=2047?e++:n>2047&&n<=65535&&(e+=2),n>=56320&&n<=57343&&t--}return e}else{if(typeof r.byteLength=="number")return r.byteLength;if(typeof r.size=="number")return r.size}throw new Error(`Body Length computation failed for ${r}`)},Pf=r=>typeof r=="string"?Pl(r):ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(r),X$=r=>typeof ArrayBuffer=="function"&&r instanceof ArrayBuffer||Object.prototype.toString.call(r)==="[object ArrayBuffer]",pP=async r=>{},J$=async r=>{const e=r?.Bucket||"";if(typeof r.Bucket=="string"&&(r.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),rz(e)){if(r.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!tz(e)||e.indexOf(".")!==-1&&!String(r.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(r.ForcePathStyle=!0);return r.DisableMultiRegionAccessPoints&&(r.disableMultiRegionAccessPoints=!0,r.DisableMRAP=!0),r},K$=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Z$=/(\d+\.){3}\d+/,ez=/\.\./,tz=r=>K$.test(r)&&!Z$.test(r)&&!ez.test(r),rz=r=>{const[e,t,n,,,i]=r.split(":"),a=e==="arn"&&r.split(":").length>=6,s=!!(a&&t&&n&&i);if(a&&!s)throw new Error(`Invalid ARN: ${r} was an invalid ARN.`);return s},nz=(r,e,t,n=!1)=>{const i=async()=>{let a;return n?a=t.clientContextParams?.[r]??t[r]??t[e]:a=t[r]??t[e],typeof a=="function"?a():a};return r==="credentialScope"||e==="CredentialScope"?async()=>{const a=typeof t.credentials=="function"?await t.credentials():t.credentials;return a?.credentialScope??a?.CredentialScope}:r==="accountId"||e==="AccountId"?async()=>{const a=typeof t.credentials=="function"?await t.credentials():t.credentials;return a?.accountId??a?.AccountId}:r==="endpoint"||e==="endpoint"?async()=>{if(t.isCustomEndpoint===!1)return;const a=await i();if(a&&typeof a=="object"){if("url"in a)return a.url.href;if("hostname"in a){const{protocol:s,hostname:o,port:l,path:u}=a;return`${s}//${o}${l?":"+l:""}${u}`}}return a}:i};function iz(r){return async(e,t,n,i)=>{if(!n.isCustomEndpoint){let o;n.serviceConfiguredEndpoint?o=await n.serviceConfiguredEndpoint():o=await r(n.serviceId),o&&(n.endpoint=()=>Promise.resolve(J1(o)),n.isCustomEndpoint=!0)}const a=await az(e,t,n);if(typeof n.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");const s=n.endpointProvider(a,i);if(n.isCustomEndpoint&&n.endpoint){const o=await n.endpoint();if(o?.headers){s.headers??={};for(const[l,u]of Object.entries(o.headers))s.headers[l]=Array.isArray(u)?u:[u]}}return s}}const az=async(r,e,t)=>{const n={},i=e?.getEndpointParameterInstructions?.()||{};for(const[a,s]of Object.entries(i))switch(s.type){case"staticContextParams":n[a]=s.value;break;case"contextParams":n[a]=r[s.name];break;case"clientContextParams":case"builtInParams":n[a]=await nz(s.name,a,t,s.type!=="builtInParams")();break;case"operationContextParams":n[a]=s.get(r);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return Object.keys(i).length===0&&Object.assign(n,t),String(t.serviceId).toLowerCase()==="s3"&&await J$(n),n};function sz(r,e,t){r.__smithy_context?r.__smithy_context.features||(r.__smithy_context.features={}):r.__smithy_context={features:{}},r.__smithy_context.features[e]=t}function oz(r){const e=iz(r);return({config:t,instructions:n})=>(i,a)=>async s=>{t.isCustomEndpoint&&sz(a,"ENDPOINT_OVERRIDE","N");const o=await e(s.input,{getEndpointParameterInstructions(){return n}},{...t},a);a.endpointV2=o,a.authSchemes=o.properties?.authSchemes;const l=a.authSchemes?.[0];if(l){a.signing_region=l.signingRegion,a.signing_service=l.signingName;const c=Ac(a)?.selectedHttpAuthScheme?.httpAuthOption;c&&(c.signingProperties=Object.assign(c.signingProperties||{},{signing_region:l.signingRegion,signingRegion:l.signingRegion,signing_service:l.signingName,signingName:l.signingName,signingRegionSet:l.signingRegionSet},l.properties))}return i({...s})}}const lz={name:"serializerMiddleware"},uz={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:lz.name};function cz(r){const e=oz(r);return(t,n)=>({applyToStack:i=>{i.addRelativeTo(e({config:t,instructions:n}),uz)}})}function dz(r){return e=>{const t=e.tls??!0,{endpoint:n,useDualstackEndpoint:i,useFipsEndpoint:a}=e,s=n!=null?async()=>J1(await _s(n)()):void 0,l=Object.assign(e,{endpoint:s,tls:t,isCustomEndpoint:!!n,useDualstackEndpoint:_s(i??!1),useFipsEndpoint:_s(a??!1)});let u;return l.serviceConfiguredEndpoint=async()=>(e.serviceId&&!u&&(u=r(e.serviceId)),u),l}}class eb{nodes;root;conditions;results;constructor(e,t,n,i){this.nodes=e,this.root=t,this.conditions=n,this.results=i}static from(e,t,n,i){return new eb(e,t,n,i)}}class fz{capacity;data=new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){const n=this.hash(e);if(n===!1)return t();if(!this.data.has(n)){if(this.data.size>this.capacity+10){const i=this.data.keys();let a=0;for(;;){const{value:s,done:o}=i.next();if(this.data.delete(s),o||++a>10)break}}this.data.set(n,t())}return this.data.get(n)}size(){return this.data.size}hash(e){let t="";const{parameters:n}=this;if(n.length===0)return!1;for(const i of n){const a=String(e[i]??"");if(a.includes("|;"))return!1;t+=a+"|;"}return t}}class _a extends Error{constructor(e){super(e),this.name="EndpointError"}}const hz="endpoints";function Ig(r){return typeof r!="object"||r==null?r:"ref"in r?`$${Ig(r.ref)}`:"fn"in r?`${r.fn}(${(r.argv||[]).map(Ig).join(", ")})`:JSON.stringify(r,null,2)}const tb={},pz=(r,e)=>r===e;function gz(...r){for(const e of r)if(e!=null)return e}const mz=r=>{const e=r.split("."),t=[];for(const n of e){const i=n.indexOf("[");if(i!==-1){if(n.indexOf("]")!==n.length-1)throw new _a(`Path: '${r}' does not end with ']'`);const a=n.slice(i+1,-1);if(Number.isNaN(parseInt(a)))throw new _a(`Invalid array index: '${a}' in path: '${r}'`);i!==0&&t.push(n.slice(0,i)),t.push(a)}else t.push(n)}return t},gP=(r,e)=>mz(e).reduce((t,n)=>{if(typeof t!="object")throw new _a(`Index '${n}' in '${e}' not found in '${JSON.stringify(r)}'`);if(Array.isArray(t)){const i=parseInt(n);return t[i<0?t.length+i:i]}return t[n]},r),yz=r=>r!=null;function vz(r,e,t){return r?e:t}const Az=r=>!r,bz=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),mP=r=>bz.test(r)||r.startsWith("[")&&r.endsWith("]"),qy={[Tf.HTTP]:80,[Tf.HTTPS]:443},wz=r=>{const e=(()=>{try{if(r instanceof URL)return r;if(typeof r=="object"&&"hostname"in r){const{hostname:d,port:h,protocol:g="",path:y="",query:v={}}=r,A=new URL(`${g}//${d}${h?`:${h}`:""}${y}`);return A.search=Object.entries(v).map(([x,S])=>`${x}=${S}`).join("&"),A}return new URL(r)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(r)} as a whatwg URL.`),null;const t=e.href,{host:n,hostname:i,pathname:a,protocol:s,search:o}=e;if(o)return null;const l=s.slice(0,-1);if(!Object.values(Tf).includes(l))return null;const u=mP(i),c=t.includes(`${n}:${qy[l]}`)||typeof r=="string"&&r.includes(`${n}:${qy[l]}`),f=`${n}${c?`:${qy[l]}`:""}`;return{scheme:l,authority:f,path:a,normalizedPath:a.endsWith("/")?a:`${a}/`,isIp:u}};function xz(r,e,t){if(t===1)return[r];if(r==="")return[""];const n=r.split(e);return t===0?n:n.slice(0,t-1).concat(n.slice(1).join(e))}const Cz=(r,e)=>r===e,Sz=(r,e,t,n)=>r==null||e>=t||r.length<t||/[^\u0000-\u007f]/.test(r)?null:n?r.substring(r.length-t,r.length-e):r.substring(e,t),Ez=r=>encodeURIComponent(r).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),kz={booleanEquals:pz,coalesce:gz,getAttr:gP,isSet:yz,isValidHostLabel:nm,ite:vz,not:Az,parseURL:wz,split:xz,stringEquals:Cz,substring:Sz,uriEncode:Ez},yP=(r,e)=>{const t=[],{referenceRecord:n,endpointParams:i}=e;let a=0;for(;a<r.length;){const s=r.indexOf("{",a);if(s===-1){t.push(r.slice(a));break}t.push(r.slice(a,s));const o=r.indexOf("}",s);if(o===-1){t.push(r.slice(s));break}r[s+1]==="{"&&r[o+1]==="}"&&(t.push(r.slice(s+1,o)),a=o+2);const l=r.substring(s+1,o);if(l.includes("#")){const[u,c]=l.split("#");t.push(gP(n[u]??i[u],c))}else t.push(n[l]??i[l]);a=o+1}return t.join("")},Tz=({ref:r},e)=>e.referenceRecord[r]??e.endpointParams[r],om=(r,e,t)=>{if(typeof r=="string")return yP(r,t);if(r.fn)return AP.callFunction(r,t);if(r.ref)return Tz(r,t);throw new _a(`'${e}': ${String(r)} is not a string, function or reference.`)},vP=({fn:r,argv:e},t)=>{const n=Array(e.length);for(let s=0;s<n.length;++s){const o=e[s];typeof o=="boolean"||typeof o=="number"?n[s]=o:n[s]=AP.evaluateExpression(o,"arg",t)}const i=r.indexOf(".");if(i!==-1){const o=tb[r.slice(0,i)]?.[r.slice(i+1)];if(typeof o=="function")return o(...n)}const a=kz[r];if(typeof a=="function")return a(...n);throw new Error(`function ${r} not loaded in endpointFunctions.`)},AP={evaluateExpression:om,callFunction:vP},Fz=(r,e)=>{const{assign:t}=r;if(t&&t in e.referenceRecord)throw new _a(`'${t}' is already defined in Reference Record.`);const n=vP(r,e);e.logger?.debug?.(`${hz} evaluateCondition: ${Ig(r)} = ${Ig(n)}`);const i=n===""?!0:!!n;return t!=null?{result:i,toAssign:{name:t,value:n}}:{result:i}},Iz=(r,e)=>Object.entries(r??{}).reduce((t,[n,i])=>(t[n]=i.map(a=>{const s=om(a,"Header value entry",e);if(typeof s!="string")throw new _a(`Header '${n}' value '${s}' is not a string`);return s}),t),{}),bP=(r,e)=>Object.entries(r).reduce((t,[n,i])=>(t[n]=xP.getEndpointProperty(i,e),t),{}),wP=(r,e)=>{if(Array.isArray(r))return r.map(t=>wP(t,e));switch(typeof r){case"string":return yP(r,e);case"object":if(r===null)throw new _a(`Unexpected endpoint property: ${r}`);return xP.getEndpointProperties(r,e);case"boolean":return r;default:throw new _a(`Unexpected endpoint property type: ${typeof r}`)}},xP={getEndpointProperty:wP,getEndpointProperties:bP},Pz=(r,e)=>{const t=om(r,"Endpoint URL",e);if(typeof t=="string")try{return new URL(t)}catch(n){throw console.error(`Failed to construct URL with ${t}`,n),n}throw new _a(`Endpoint URL must be a string, got ${typeof t}`)},Wy=1e8,Dz=(r,e)=>{const{nodes:t,root:n,results:i,conditions:a}=r;let s=n;const o={},l={referenceRecord:o,endpointParams:e.endpointParams,logger:e.logger};for(;s!==1&&s!==-1&&s<Wy;){const u=3*(Math.abs(s)-1),[c,f,d]=[t[u],t[u+1],t[u+2]],[h,g,y]=a[c],v=Fz({fn:h,assign:y,argv:g},l);if(v.toAssign){const{name:A,value:x}=v.toAssign;o[A]=x}s=s>=0===v.result?f:d}if(s>=Wy){const u=i[s-Wy];if(u[0]===-1){const[,h]=u;throw new _a(om(h,"Error",l))}const[c,f,d]=u;return{url:Pz(c,l),properties:bP(f,l),headers:Iz(d??{},l)}}throw new _a("No matching endpoint.")},Rz=dz(pP),CP=cz(pP);class Qy extends x$(am,Pl,Tg,im){}const Oz=r=>crypto.getRandomValues(r),SP=C$(Oz),Bz=SP,PA=async(r=new Uint8Array,e)=>{if(r instanceof Uint8Array)return Qy.mutate(r);if(!r)return Qy.mutate(new Uint8Array);const t=e.streamCollector(r);return Qy.mutate(await t)};class Mz{serdeContext;setSerdeContext(e){this.serdeContext=e}}class _z extends Mz{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=ta.for(e.defaultNamespace);for(const t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return aa}getResponseType(){return oc}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,e.query||(e.query={});for(const[n,i]of t.url.searchParams.entries())e.query[n]=i;if(t.headers)for(const n in t.headers)e.headers[n]=t.headers[n].join(", ");return e}else{if(e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},t.headers)for(const n in t.headers)e.headers[n]=t.headers[n];return e}}setHostPrefix(e,t,n){if(this.serdeContext?.disableHostPrefix)return;const i=yi.of(t.input),a=jd(t.traits??{});if(a.endpoint){let s=a.endpoint?.[0];if(typeof s=="string"){for(const[o,l]of i.structIterator()){if(!l.getMergedTraits().hostLabel)continue;const u=n[o];if(typeof u!="string")throw new Error(`@smithy/core/schema - ${o} in input must be a string as hostLabel.`);s=s.replace(`{${o}}`,u)}e.hostname=s+e.hostname}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n})}async loadEventStreamCapability(){const{EventStreamSerde:e,eventStreamSerdeProvider:t}=await Promise.resolve().then(()=>require("./index.browser-DDw6AnVr.cjs")),n=this.resolveEventStreamMarshaller(t);return new e({marshaller:n,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}resolveEventStreamMarshaller(e){const t=this.serdeContext;return t.eventStreamMarshaller?t.eventStreamMarshaller:e(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,n,i,a){return[]}getEventStreamMarshaller(){const e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class Nz extends _z{async serializeRequest(e,t,n){const i=this.serializer,a={},s={},o=await n.endpoint(),l=yi.of(e?.input),u=l.getSchema();let c;const f=t&&typeof t=="object"?t:{},d=new aa({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:a,headers:s,body:void 0});if(o&&(this.updateServiceEndpoint(d,o),this.setHostPrefix(d,e,f)),f){const h=l.getEventStreamMember();if(h){if(f[h]){const g={};for(const[y,v]of l.structIterator())y!==h&&f[y]&&(i.write(v,f[y]),g[y]=i.flush());c=await this.serializeEventStream({eventStream:f[h],requestSchema:l,initialRequest:g})}}else i.write(u,f),c=i.flush()}return d.headers=Object.assign(d.headers,s),d.query=a,d.body=c,d.method="POST",d}async deserializeResponse(e,t,n){const i=this.deserializer,a=yi.of(e.output),s={};if(n.statusCode>=300){const l=await PA(n.body,t);throw l.byteLength>0&&Object.assign(s,await i.read(15,l)),await this.handleError(e,t,n,s,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(const l in n.headers){const u=n.headers[l];delete n.headers[l],n.headers[l.toLowerCase()]=u}const o=a.getEventStreamMember();if(o)s[o]=await this.deserializeEventStream({response:n,responseSchema:a,initialResponseContainer:s});else{const l=await PA(n.body,t);l.byteLength>0&&Object.assign(s,await i.read(a,l))}return s.$metadata=this.deserializeMetadata(n),s}}function EP(r,e){if(e.timestampFormat.useTrait&&r.isTimestampSchema()&&(r.getSchema()===5||r.getSchema()===6||r.getSchema()===7))return r.getSchema();const{httpLabel:t,httpPrefixHeaders:n,httpHeader:i,httpQuery:a}=r.getMergedTraits();return(e.httpBindings?typeof n=="string"||i?6:a||t?5:void 0:void 0)??e.timestampFormat.default}const Lz=r=>({setHttpHandler(e){r.httpHandler=e},httpHandler(){return r.httpHandler},updateHttpClientConfig(e,t){r.httpHandler?.updateHttpClientConfig(e,t)},httpHandlerConfigs(){return r.httpHandler.httpHandlerConfigs()}}),Uz=r=>({httpHandler:r.httpHandler()}),ZE="content-length";function Vz(r){return e=>async t=>{const n=t.request;if(aa.isInstance(n)){const{body:i,headers:a}=n;if(i&&Object.keys(a).map(s=>s.toLowerCase()).indexOf(ZE)===-1)try{const s=r(i);n.headers={...n.headers,[ZE]:String(s)}}catch{}}return e({...t,request:n})}}const $z={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},zz=r=>({applyToStack:e=>{e.add(Vz(r.bodyLengthChecker),$z)}}),kl=r=>encodeURIComponent(r).replace(/[!'()*]/g,Hz),Hz=r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`;function Gz(r){const e=[];for(let t of Object.keys(r).sort()){const n=r[t];if(t=kl(t),Array.isArray(n))for(let i=0,a=n.length;i<a;i++)e.push(`${t}=${kl(n[i])}`);else{let i=t;(n||typeof n=="string")&&(i+=`=${kl(n)}`),e.push(i)}}return e.join("&")}const jz=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],qz=["TimeoutError","RequestTimeout","RequestTimeoutException"],Wz=[500,502,503,504],Qz=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],Yz=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EAI_AGAIN"],Xz=r=>r?.$retryable!==void 0,Jz=r=>r.$metadata?.clockSkewCorrected,Kz=r=>{const e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return r&&r instanceof TypeError?e.has(r.message):!1},kP=r=>r.$metadata?.httpStatusCode===429||jz.includes(r.name)||r.$retryable?.throttling==!0,rb=(r,e=0)=>Xz(r)||Jz(r)||r.name==="InvalidSignatureException"&&r.message?.includes("Signature expired")||qz.includes(r.name)||Qz.includes(r?.code||"")||Yz.includes(r?.code||"")||Wz.includes(r.$metadata?.httpStatusCode||0)||Kz(r)||eH(r)||r.cause!==void 0&&e<=10&&rb(r.cause,e+1),Zz=r=>{if(r.$metadata?.httpStatusCode!==void 0){const e=r.$metadata.httpStatusCode;return 500<=e&&e<=599&&!rb(r)}return!1};function eH(r){return r.code==="ERR_HTTP2_STREAM_ERROR"&&r.message.includes("NGHTTP2_REFUSED_STREAM")}const TP=20*1e3,e2=500,tH=1,rH="amz-sdk-invocation-id",nH="amz-sdk-request";function iH(r,e){if(oc.isInstance(r))for(const t of Object.keys(r.headers)){const n=t.toLowerCase();if(n==="retry-after"){const i=r.headers[t];let a=NaN;if(i.endsWith("GMT"))try{a=(dP(i).getTime()-Date.now())/1e3}catch(s){e?.trace?.("Failed to parse retry-after header"),e?.trace?.(s)}else i.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?a=Number(i.match(/ GMT, ([\d.]+)$/)?.[1]):i.match(/^((\d+)|(\d+\.\d+))$/)?a=Number(i):Date.parse(i)>=Date.now()&&(a=(Date.parse(i)-Date.now())/1e3);return isNaN(a)?void 0:new Date(Date.now()+a*1e3)}else if(n==="x-amz-retry-after"){const i=r.headers[t],a=Number(i);if(isNaN(a)){e?.trace?.(`Failed to parse x-amz-retry-after=${i}`);return}return new Date(Date.now()+a)}}}const aH=r=>r instanceof Error?r:r instanceof Object?Object.assign(new Error,r):typeof r=="string"?new Error(r):new Error(`AWS SDK error wrapper for ${r}`);function sH(r){return e=>(t,n)=>async i=>{let a=await e.retryStrategy();const s=await e.maxAttempts();if(lH(a)){a=a;let o=await a.acquireInitialRetryToken((n.partition_id??"")+(n.__retryLongPoll?":longpoll":"")),l=new Error,u=0,c=0;const{request:f}=i,d=aa.isInstance(f);for(d&&(f.headers[rH]=SP());;)try{d&&(f.headers[nH]=`attempt=${u+1}; max=${s}`);const{response:h,output:g}=await t(i);return a.recordSuccess(o),g.$metadata.attempts=u+1,g.$metadata.totalRetryDelay=c,{response:h,output:g}}catch(h){const g=uH(h,e.logger);if(l=aH(h),d&&r(f))throw(n.logger instanceof lP?console:n.logger)?.warn("An error was encountered in a non-retryable streaming request."),l;try{o=await a.refreshRetryTokenForRetry(o,g)}catch{throw l.$metadata||(l.$metadata={}),l.$metadata.attempts=u+1,l.$metadata.totalRetryDelay=c,l}u=o.getRetryCount();const y=o.getRetryDelay();c+=(o?.$retryLog?.acquisitionDelay??0)+y,y>0&&await oH(y)}}else return a=a,a?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",a.mode]]),a.retry(t,i)}}const oH=r=>new Promise(e=>setTimeout(e,r)),lH=r=>typeof r.acquireInitialRetryToken<"u"&&typeof r.refreshRetryTokenForRetry<"u"&&typeof r.recordSuccess<"u",uH=(r,e)=>{const t={error:r,errorType:cH(r)},n=iH(r.$response,e);return n&&(t.retryAfterHint=n),t},cH=r=>kP(r)?"THROTTLING":rb(r)?"TRANSIENT":Zz(r)?"SERVER_ERROR":"CLIENT_ERROR",dH={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0};function fH(r){const e=sH(r);return t=>({applyToStack:n=>{n.add(e(t),dH)}})}class nb{static setTimeoutFn=(e,t)=>setTimeout(e,t);beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let t;this.updateMeasuredRate();const n=e;if(n?.errorType==="THROTTLING"||kP(n?.error??e)){const s=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const a=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(a)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){for(this.refillTokenBucket();e>this.availableTokens;){const t=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(n=>nb.setTimeoutFn(n,t)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const t=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+t),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(e*2)/2;if(this.requestCount++,t>this.lastTxRateBucket){const n=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}class ki{static v2026=typeof process<"u"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return ki.v2026?50:100}static throttlingDelay(){return ki.v2026?1e3:500}static cost(){return ki.v2026?14:5}static throttlingCost(){return ki.v2026?5:10}static modifiedCostType(){return ki.v2026?"THROTTLING":"TRANSIENT"}}class hH{x=ki.delay();computeNextBackoffDelay(e){const i=Math.random()*Math.min(this.x*2**e,TP);return Math.floor(i)}setDelayBase(e){this.x=e}}class t2{delay;count;cost;longPoll;$retryLog={acquisitionDelay:0};constructor(e,t,n,i){this.delay=e,this.count=t,this.cost=n,this.longPoll=i}getRetryCount(){return this.count}getRetryDelay(){return Math.min(TP,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}var Bo;(function(r){r.STANDARD="standard",r.ADAPTIVE="adaptive"})(Bo||(Bo={}));const nf=3,pH=Bo.STANDARD,Ip={incompatible:1,attempts:2,capacity:3};class DA{mode=Bo.STANDARD;retryBackoffStrategy;capacity=e2;maxAttemptsProvider;baseDelay;constructor(e){typeof e=="number"?this.maxAttemptsProvider=async()=>e:typeof e=="function"?this.maxAttemptsProvider=e:e&&typeof e=="object"&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>nf,this.baseDelay??=ki.delay(),this.retryBackoffStrategy??=new hH}async acquireInitialRetryToken(e){return new t2(ki.delay(),0,void 0,ki.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts(),i=this.retryCode(e,t,n),a=i===0,s=e.isLongPoll?.();if(a||s){const o=t.errorType;this.retryBackoffStrategy.setDelayBase(o==="THROTTLING"?ki.throttlingDelay():this.baseDelay);const l=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount());let u=l;if(t.retryAfterHint instanceof Date&&(u=Math.max(l,Math.min(t.retryAfterHint.getTime()-Date.now(),l+5e3))),a){const c=this.getCapacityCost(o);this.capacity-=c;const f=new t2(0,e.getRetryCount()+1,c,e.isLongPoll?.()??!1);return await new Promise(d=>setTimeout(d,u)),f.$retryLog.acquisitionDelay=u,f}else{const c=ki.v2026&&i===Ip.capacity&&s?u:0;c>0&&await new Promise(f=>setTimeout(f,c))}}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(e2,this.capacity+(e.getRetryCost()??tH))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${nf}`),nf}}retryCode(e,t,n){const i=e.getRetryCount()+1,a=this.isRetryableError(t.errorType)?0:Ip.incompatible,s=i<n?0:Ip.attempts,o=this.capacity>=this.getCapacityCost(t.errorType)?0:Ip.capacity;return a||s||o}getCapacityCost(e){return e===ki.modifiedCostType()?ki.throttlingCost():ki.cost()}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class gH{mode=Bo.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,t){const{rateLimiter:n}=t??{};this.rateLimiter=n??new nb,this.standardRetryStrategy=t?new DA({maxAttempts:typeof e=="number"?e:3,...t}):new DA(e)}async acquireInitialRetryToken(e){const t=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),t}async refreshRetryTokenForRetry(e,t){this.rateLimiter.updateClientSendingRate(t);const n=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,t);return await this.rateLimiter.getSendToken(),n}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}const mH=(r,e)=>{const{retryStrategy:t,retryMode:n}=r,{defaultMaxAttempts:i=nf,defaultBaseDelay:a=ki.delay()}={},s=_s(r.maxAttempts??i);let o=t?Promise.resolve(t):void 0;const l=async()=>{const u=await s();return await _s(n)()===Bo.ADAPTIVE?new gH(s,{maxAttempts:u,baseDelay:a}):new DA({maxAttempts:u,baseDelay:a})};return Object.assign(r,{maxAttempts:s,retryStrategy:()=>o??=l()})},yH=fH(e$);ki.v2026||=typeof process=="object"&&process.env?.AWS_NEW_RETRIES_2026==="true";function Ds(r,e,t){r.__aws_sdk_context?r.__aws_sdk_context.features||(r.__aws_sdk_context.features={}):r.__aws_sdk_context={features:{}},r.__aws_sdk_context.features[e]=t}const vH=r=>e=>async t=>{if(!aa.isInstance(t.request))return e(t);const{request:n}=t,{handlerProtocol:i=""}=r.requestHandler.metadata||{};if(i.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let a=n.hostname;n.port!=null&&(a+=`:${n.port}`),n.headers.host=a}return e(t)},AH={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},bH=r=>({applyToStack:e=>{e.add(vH(r),AH)}}),wH=()=>(r,e)=>async t=>{try{const n=await r(t),{clientName:i,commandName:a,logger:s,dynamoDbDocumentClientOptions:o={}}=e,{overrideInputFilterSensitiveLog:l,overrideOutputFilterSensitiveLog:u}=o,c=l??e.inputFilterSensitiveLog,f=u??e.outputFilterSensitiveLog,{$metadata:d,...h}=n.output;return s?.info?.({clientName:i,commandName:a,input:c(t.input),output:f(h),metadata:d}),n}catch(n){const{clientName:i,commandName:a,logger:s,dynamoDbDocumentClientOptions:o={}}=e,{overrideInputFilterSensitiveLog:l}=o,u=l??e.inputFilterSensitiveLog;throw s?.error?.({clientName:i,commandName:a,input:u(t.input),error:n,metadata:n.$metadata}),n}},xH={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},CH=r=>({applyToStack:e=>{e.add(wH(),xH)}}),SH=r=>({applyToStack:e=>{}}),EH=(r,e)=>{if(!e||e.length===0)return r;const t=[];for(const n of e)for(const i of r)i.schemeId.split("#")[1]===n&&t.push(i);for(const n of r)t.find(({schemeId:i})=>i===n.schemeId)||t.push(n);return t};function kH(r){const e=new Map;for(const t of r)e.set(t.schemeId,t);return e}const TH=(r,e)=>(t,n)=>async i=>{const a=r.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(r,n,i.input)),s=r.authSchemePreference?await r.authSchemePreference():[],o=EH(a,s),l=kH(r.httpAuthSchemes),u=Ac(n),c=[];for(const f of o){const d=l.get(f.schemeId);if(!d){c.push(`HttpAuthScheme \`${f.schemeId}\` was not enabled for this service.`);continue}const h=d.identityProvider(await e.identityProviderConfigProvider(r));if(!h){c.push(`HttpAuthScheme \`${f.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:g={},signingProperties:y={}}=f.propertiesExtractor?.(r,n)||{};f.identityProperties=Object.assign(f.identityProperties||{},g),f.signingProperties=Object.assign(f.signingProperties||{},y),u.selectedHttpAuthScheme={httpAuthOption:f,identity:await h(f.identityProperties),signer:d.signer};break}if(!u.selectedHttpAuthScheme)throw new Error(c.join(`
|
|
3050
|
-
`));return t(i)},FH={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},IH=(r,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t})=>({applyToStack:n=>{n.addRelativeTo(TH(r,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t}),FH)}}),PH=r=>e=>{throw e},DH=(r,e)=>{},RH=r=>(e,t)=>async n=>{if(!aa.isInstance(n.request))return e(n);const a=Ac(t).selectedHttpAuthScheme;if(!a)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:s={}},identity:o,signer:l}=a,u=await e({...n,request:await l.sign(n.request,o,s)}).catch((l.errorHandler||PH)(s));return(l.successHandler||DH)(u.response,s),u},OH={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},BH=r=>({applyToStack:e=>{e.addRelativeTo(RH(),OH)}}),af=r=>{if(typeof r=="function")return r;const e=Promise.resolve(r);return()=>e};class MH{authSchemes=new Map;constructor(e){for(const t in e){const n=e[t];n!==void 0&&this.authSchemes.set(t,n)}}getIdentityProvider(e){return this.authSchemes.get(e)}}class _H{async sign(e,t,n){return e}}const NH=r=>function(t){return FP(t)&&t.expiration.getTime()-Date.now()<r},LH=3e5,UH=NH(LH),FP=r=>r.expiration!==void 0,VH=(r,e,t)=>{if(r===void 0)return;const n=typeof r!="function"?async()=>Promise.resolve(r):r;let i,a,s,o=!1;const l=async u=>{a||(a=n(u));try{i=await a,s=!0,o=!1}finally{a=void 0}return i};return e===void 0?async u=>((!s||u?.forceRefresh)&&(i=await l(u)),i):async u=>((!s||u?.forceRefresh)&&(i=await l(u)),o?i:t(i)?(e(i)&&await l(u),i):(o=!0,i))},$H=void 0;function zH(r){return r===void 0?!0:typeof r=="string"&&r.length<=50}function HH(r){const e=af(r.userAgentAppId??$H),{customUserAgent:t}=r;return Object.assign(r,{customUserAgent:typeof t=="string"?[[t]]:t,userAgentAppId:async()=>{const n=await e();if(!zH(n)){const i=r.logger?.constructor?.name==="NoOpLogger"||!r.logger?console:r.logger;typeof n!="string"?i?.warn("userAgentAppId must be a string or undefined."):n.length>50&&i?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return n}})}const GH={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}]};let jH=GH;const qH=r=>{const{partitions:e}=jH;for(const n of e){const{regions:i,outputs:a}=n;for(const[s,o]of Object.entries(i))if(s===r)return{...a,...o}}for(const n of e){const{regionRegex:i,outputs:a}=n;if(new RegExp(i).test(r))return{...a}}const t=e.find(n=>n.id==="aws");if(!t)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...t.outputs}},WH=/\d{12}\.ddb/;async function QH(r,e,t){if(t.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&Ds(r,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){const a=await e.retryStrategy();if(typeof a.mode=="string")switch(a.mode){case Bo.ADAPTIVE:Ds(r,"RETRY_MODE_ADAPTIVE","F");break;case Bo.STANDARD:Ds(r,"RETRY_MODE_STANDARD","E");break}}if(typeof e.accountIdEndpointMode=="function"){const a=r.endpointV2;switch(String(a?.url?.hostname).match(WH)&&Ds(r,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":Ds(r,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":Ds(r,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":Ds(r,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const i=r.__smithy_context?.selectedHttpAuthScheme?.identity;if(i?.$source){const a=i;a.accountId&&Ds(r,"RESOLVED_ACCOUNT_ID","T");for(const[s,o]of Object.entries(a.$source??{}))Ds(r,s,o)}}const r2="user-agent",Yy="x-amz-user-agent",n2=" ",Xy="/",YH=/[^!$%&'*+\-.^_`|~\w]/g,XH=/[^!$%&'*+\-.^_`|~\w#]/g,i2="-",JH=1024;function KH(r){let e="";for(const t in r){const n=r[t];if(e.length+n.length+1<=JH){e.length?e+=","+n:e+=n;continue}break}return e}const ZH=r=>(e,t)=>async n=>{const{request:i}=n;if(!aa.isInstance(i))return e(n);const{headers:a}=i,s=t?.userAgent?.map(Pp)||[],o=(await r.defaultUserAgentProvider()).map(Pp);await QH(t,r,n);const l=t;o.push(`m/${KH(Object.assign({},t.__smithy_context?.features,l.__aws_sdk_context?.features))}`);const u=r?.customUserAgent?.map(Pp)||[],c=await r.userAgentAppId();c&&o.push(Pp(["app",`${c}`]));const f=[].concat([...o,...s,...u]).join(n2),d=[...o.filter(h=>h.startsWith("aws-sdk-")),...u].join(n2);return r.runtime!=="browser"?(d&&(a[Yy]=a[Yy]?`${a[r2]} ${d}`:d),a[r2]=f):a[Yy]=f,e({...n,request:i})},Pp=r=>{const e=r[0].split(Xy).map(s=>s.replace(YH,i2)).join(Xy),t=r[1]?.replace(XH,i2),n=e.indexOf(Xy),i=e.substring(0,n);let a=e.substring(n+1);return i==="api"&&(a=a.toLowerCase()),[i,a,t].filter(s=>s&&s.length>0).reduce((s,o,l)=>{switch(l){case 0:return o;case 1:return`${s}/${o}`;default:return`${s}#${o}`}},"")},eG={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},tG=r=>({applyToStack:e=>{e.add(ZH(r),eG)}}),rG=({serviceId:r,clientVersion:e})=>async t=>{const n=typeof window<"u"?window.navigator:void 0,i=n?.userAgent??"",a=n?.userAgentData?.platform??a2.os(i)??"other",s=void 0,o=n?.userAgentData?.brands??[],l=o[o.length-1],u=l?.brand??a2.browser(i)??"unknown",c=l?.version??"unknown",f=[["aws-sdk-js",e],["ua","2.1"],[`os/${a}`,s],["lang/js"],["md/browser",`${u}_${c}`]];r&&f.push([`api/${r}`,e]);const d=await t?.userAgentAppId?.();return d&&f.push([`app/${d}`]),f},a2={os(r){if(/iPhone|iPad|iPod/.test(r))return"iOS";if(/Macintosh|Mac OS X/.test(r))return"macOS";if(/Windows NT/.test(r))return"Windows";if(/Android/.test(r))return"Android";if(/Linux/.test(r))return"Linux"},browser(r){if(/EdgiOS|EdgA|Edg\//.test(r))return"Microsoft Edge";if(/Firefox\//.test(r))return"Firefox";if(/Chrome\//.test(r))return"Chrome";if(/Safari\//.test(r))return"Safari"}},IP=(r,e=!1)=>{if(e){for(const t of r.split("."))if(!IP(t))return!1;return!0}return!(!nm(r)||r.length<3||r.length>63||r!==r.toLowerCase()||mP(r))},s2=":",nG="/",iG=r=>{const e=r.split(s2);if(e.length<6)return null;const[t,n,i,a,s,...o]=e;if(t!=="arn"||n===""||i===""||o.join(s2)==="")return null;const l=o.map(u=>u.split(nG)).flat();return{partition:n,service:i,region:a,accountId:s,resourceId:l}},PP={isVirtualHostableS3Bucket:IP,parseArn:iG,partition:qH};tb.aws=PP;const aG=(r,e,t)=>{let n,i,a,s=!1;const o=async()=>{i||(i=r());try{n=await i,a=!0,s=!1}finally{i=void 0}return n};return async l=>((!a||l?.forceRefresh)&&(n=await o()),n)},o2=new Set,sG=(r,e=nm)=>{if(!o2.has(r)&&!e(r))if(r==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${r}" is not a valid hostname component.`);else o2.add(r)},DP=r=>typeof r=="string"&&(r.startsWith("fips-")||r.endsWith("-fips")),oG=r=>DP(r)?["fips-aws-global","aws-fips"].includes(r)?"us-east-1":r.replace(/fips-(dkr-|prod-)?|-fips/,""):r,lG=r=>{const{region:e,useFipsEndpoint:t}=r;if(!e)throw new Error("Region is missing");return Object.assign(r,{region:async()=>{const n=typeof e=="function"?await e():e,i=oG(n);return sG(i),i},useFipsEndpoint:async()=>{const n=typeof e=="string"?e:await e();return DP(n)?!0:typeof t!="function"?Promise.resolve(!!t):t()}})},uG=["in-region","cross-region","mobile","standard","legacy"],cG=({defaultsMode:r}={})=>aG(async()=>{const e=typeof r=="function"?await r():r;switch(e?.toLowerCase()){case"auto":return Promise.resolve(dG()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${uG.join(", ")}, got ${e}`)}}),dG=()=>{const r=window?.navigator;if(r?.connection){const{effectiveType:e,rtt:t,downlink:n}=r?.connection;if(typeof e=="string"&&e!=="4g"||Number(t)>100||Number(n)<10)return!0}return r?.userAgentData?.mobile||typeof r?.maxTouchPoints=="number"&&r?.maxTouchPoints>1},fG=!1,hG=!1,pG=r=>({setRegion(e){r.region=e},region(){return r.region}}),gG=r=>({region:r.region()}),l2=r=>oc.isInstance(r)?r.headers?.date??r.headers?.Date:void 0,RP=r=>new Date(Date.now()+r),mG=(r,e)=>Math.abs(RP(e).getTime()-r)>=3e5,u2=(r,e)=>{const t=Date.parse(r);return mG(t,e)?t-Date.now():e},sf=(r,e)=>{if(!e)throw new Error(`Property \`${r}\` is not resolved for AWS SDK SigV4Auth`);return e},yG=async r=>{const e=sf("context",r.context),t=sf("config",r.config),n=e.endpointV2?.properties?.authSchemes?.[0],a=await sf("signer",t.signer)(n),s=r?.signingRegion,o=r?.signingRegionSet,l=r?.signingName;return{config:t,signer:a,signingRegion:s,signingRegionSet:o,signingName:l}};class vG{async sign(e,t,n){if(!aa.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const i=await yG(n),{config:a,signer:s}=i;let{signingRegion:o,signingName:l}=i;const u=n.context;if(u?.authSchemes?.length??!1){const[f,d]=u.authSchemes;f?.name==="sigv4a"&&d?.name==="sigv4"&&(o=d?.signingRegion??o,l=d?.signingName??l)}return n._preRequestSystemClockOffset=a.systemClockOffset,await s.sign(e,{signingDate:RP(a.systemClockOffset),signingRegion:o,signingService:l})}errorHandler(e){return t=>{const n=t,i=n.ServerTime??l2(n.$response);if(i){const a=sf("config",e.config),s=e._preRequestSystemClockOffset,o=u2(i,a.systemClockOffset);(o!==a.systemClockOffset||s!==void 0&&s!==o)&&n.$metadata&&(a.systemClockOffset=o,n.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=l2(e);if(n){const i=sf("config",t.config);i.systemClockOffset=u2(n,i.systemClockOffset)}}}class AG{format(e){const t=[];for(const a of Object.keys(e)){const s=Pl(a);t.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[a]))}const n=new Uint8Array(t.reduce((a,s)=>a+s.byteLength,0));let i=0;for(const a of t)n.set(a,i),i+=a.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const i=new Uint8Array(9);return i[0]=5,i.set(e.value.bytes,1),i;case"binary":const a=new DataView(new ArrayBuffer(3+e.value.byteLength));a.setUint8(0,6),a.setUint16(1,e.value.byteLength,!1);const s=new Uint8Array(a.buffer);return s.set(e.value,3),s;case"string":const o=Pl(e.value),l=new DataView(new ArrayBuffer(3+o.byteLength));l.setUint8(0,7),l.setUint16(1,o.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(o,3),u;case"timestamp":const c=new Uint8Array(9);return c[0]=8,c.set(ib.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!bG.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const f=new Uint8Array(17);return f[0]=9,f.set(hP(e.value.replace(/\-/g,"")),1),f}}}var c2;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(c2||(c2={}));const bG=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class ib{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let n=7,i=Math.abs(Math.round(e));n>-1&&i>0;n--,i/=256)t[n]=i;return e<0&&d2(t),new ib(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&d2(e),parseInt(xo(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function d2(r){for(let e=0;e<8;e++)r[e]^=255;for(let e=7;e>-1&&(r[e]++,r[e]===0);e--);}const wG="X-Amz-Algorithm",xG="X-Amz-Credential",OP="X-Amz-Date",CG="X-Amz-SignedHeaders",SG="X-Amz-Expires",BP="X-Amz-Signature",MP="X-Amz-Security-Token",_P="authorization",NP=OP.toLowerCase(),EG="date",kG=[_P,NP,EG],TG=BP.toLowerCase(),RA="x-amz-content-sha256",FG=MP.toLowerCase(),IG={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},PG=/^proxy-/,DG=/^sec-/,Jy="AWS4-HMAC-SHA256",RG="AWS4-HMAC-SHA256-PAYLOAD",OG="UNSIGNED-PAYLOAD",BG=50,LP="aws4_request",MG=3600*24*7,_G=({query:r={}})=>{const e=[],t={};for(const n of Object.keys(r)){if(n.toLowerCase()===TG)continue;const i=kl(n);e.push(i);const a=r[n];typeof a=="string"?t[i]=`${i}=${kl(a)}`:Array.isArray(a)&&(t[i]=a.slice(0).reduce((s,o)=>s.concat([`${i}=${kl(o)}`]),[]).sort().join("&"))}return e.sort().map(n=>t[n]).filter(n=>n).join("&")},NG=r=>LG(r).toISOString().replace(/\.\d{3}Z$/,"Z"),LG=r=>typeof r=="number"?new Date(r*1e3):typeof r=="string"?Number(r)?new Date(Number(r)*1e3):new Date(r):r;class UG{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:s=!0}){this.service=i,this.sha256=a,this.uriEscapePath=s,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=_s(n),this.credentialProvider=_s(t)}createCanonicalRequest(e,t,n){const i=Object.keys(t).sort();return`${e.method}
|
|
3052
|
+
`),O$={warn:console.warn},B$=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Z1=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function M$(r){const e=r.getUTCFullYear(),t=r.getUTCMonth(),n=r.getUTCDay(),i=r.getUTCDate(),a=r.getUTCHours(),s=r.getUTCMinutes(),o=r.getUTCSeconds(),l=i<10?`0${i}`:`${i}`,u=a<10?`0${a}`:`${a}`,c=s<10?`0${s}`:`${s}`,f=o<10?`0${o}`:`${o}`;return`${B$[n]}, ${l} ${Z1[t]} ${e} ${u}:${c}:${f} GMT`}const _$=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),N$=r=>{if(r==null)return;if(typeof r!="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");const e=_$.exec(r);if(!e)throw new TypeError("Invalid RFC-3339 date-time value");const[t,n,i,a,s,o,l,u,c]=e,f=Fg(If(n)),d=wo(i,"month",1,12),h=wo(a,"day",1,31),g=ng(f,d,h,{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u});return c.toUpperCase()!="Z"&&g.setTime(g.getTime()-Y$(c)),g},L$=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d{2}) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),U$=new RegExp(/^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d{2})-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? GMT$/),V$=new RegExp(/^(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( [1-9]|\d{2}) (\d{1,2}):(\d{2}):(\d{2})(?:\.(\d+))? (\d{4})$/),dP=r=>{if(r==null)return;if(typeof r!="string")throw new TypeError("RFC-7231 date-times must be expressed as strings");let e=L$.exec(r);if(e){const[t,n,i,a,s,o,l,u]=e;return ng(Fg(If(a)),jy(i),wo(n,"day",1,31),{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u})}if(e=U$.exec(r),e){const[t,n,i,a,s,o,l,u]=e;return G$(ng(z$(a),jy(i),wo(n,"day",1,31),{hours:s,minutes:o,seconds:l,fractionalMilliseconds:u}))}if(e=V$.exec(r),e){const[t,n,i,a,s,o,l,u]=e;return ng(Fg(If(u)),jy(n),wo(i.trimLeft(),"day",1,31),{hours:a,minutes:s,seconds:o,fractionalMilliseconds:l})}throw new TypeError("Invalid RFC-7231 date-time value")},$$=r=>{if(r==null)return;let e;if(typeof r=="number")e=r;else if(typeof r=="string")e=F$(r);else if(typeof r=="object"&&r.tag===1)e=r.value;else throw new TypeError("Epoch timestamps must be expressed as floating point numbers or their string representation");if(Number.isNaN(e)||e===1/0||e===-1/0)throw new TypeError("Epoch timestamps must be valid, non-Infinite, non-NaN numerics");return new Date(Math.round(e*1e3))},ng=(r,e,t,n)=>{const i=e-1;return q$(r,i,t),new Date(Date.UTC(r,i,t,wo(n.hours,"hour",0,23),wo(n.minutes,"minute",0,59),wo(n.seconds,"seconds",0,60),Q$(n.fractionalMilliseconds)))},z$=r=>{const e=new Date().getUTCFullYear(),t=Math.floor(e/100)*100+Fg(If(r));return t<e?t+100:t},H$=50*365*24*60*60*1e3,G$=r=>r.getTime()-new Date().getTime()>H$?new Date(Date.UTC(r.getUTCFullYear()-100,r.getUTCMonth(),r.getUTCDate(),r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds())):r,jy=r=>{const e=Z1.indexOf(r);if(e<0)throw new TypeError(`Invalid month: ${r}`);return e+1},j$=[31,28,31,30,31,30,31,31,30,31,30,31],q$=(r,e,t)=>{let n=j$[e];if(e===1&&W$(r)&&(n=29),t>n)throw new TypeError(`Invalid day for ${Z1[e]} in ${r}: ${t}`)},W$=r=>r%4===0&&(r%100!==0||r%400===0),wo=(r,e,t,n)=>{const i=D$(If(r));if(i<t||i>n)throw new TypeError(`${e} must be between ${t} and ${n}, inclusive`);return i},Q$=r=>r==null?0:I$("0."+r)*1e3,Y$=r=>{const e=r[0];let t=1;if(e=="+")t=1;else if(e=="-")t=-1;else throw new TypeError(`Offset direction, ${e}, must be "+" or "-"`);const n=Number(r.substring(1,3)),i=Number(r.substring(4,6));return t*(n*60+i)*60*1e3},If=r=>{let e=0;for(;e<r.length-1&&r.charAt(e)==="0";)e++;return e===0?r:r.slice(e)},yo=function(e){return Object.assign(new String(e),{deserializeJSON(){return JSON.parse(String(e))},toString(){return String(e)},toJSON(){return String(e)}})};yo.from=r=>r&&typeof r=="object"&&(r instanceof yo||"deserializeJSON"in r)?r:typeof r=="string"||Object.getPrototypeOf(r)===String.prototype?yo(String(r)):yo(JSON.stringify(r));yo.fromObject=yo.from;const JE=/^-?\d*(\.\d+)?$/;class as{string;type;constructor(e,t){if(this.string=e,this.type=t,!JE.test(e))throw new Error('@smithy/core/serde - NumericValue must only contain [0-9], at most one decimal point ".", and an optional negation prefix "-".')}toString(){return this.string}static[Symbol.hasInstance](e){if(!e||typeof e!="object")return!1;const t=e;return as.prototype.isPrototypeOf(e)||t.type==="bigDecimal"&&JE.test(t.string)}}const fP={},IA={};for(let r=0;r<256;r++){let e=r.toString(16).toLowerCase();e.length===1&&(e=`0${e}`),fP[r]=e,IA[e]=r}function hP(r){if(r.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const e=new Uint8Array(r.length/2);for(let t=0;t<r.length;t+=2){const n=r.slice(t,t+2).toLowerCase();if(n in IA)e[t/2]=IA[n];else throw new Error(`Cannot decode unrecognized sequence ${n} as hexadecimal`)}return e}function xo(r){let e="";for(let t=0;t<r.byteLength;t++)e+=fP[r[t]];return e}const KE=typeof TextEncoder=="function"?new TextEncoder:null,X$=r=>{if(typeof r=="string"){if(KE)return KE.encode(r).byteLength;let e=r.length;for(let t=e-1;t>=0;t--){const n=r.charCodeAt(t);n>127&&n<=2047?e++:n>2047&&n<=65535&&(e+=2),n>=56320&&n<=57343&&t--}return e}else{if(typeof r.byteLength=="number")return r.byteLength;if(typeof r.size=="number")return r.size}throw new Error(`Body Length computation failed for ${r}`)},Pf=r=>typeof r=="string"?Pl(r):ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(r),J$=r=>typeof ArrayBuffer=="function"&&r instanceof ArrayBuffer||Object.prototype.toString.call(r)==="[object ArrayBuffer]",pP=async r=>{},K$=async r=>{const e=r?.Bucket||"";if(typeof r.Bucket=="string"&&(r.Bucket=e.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"))),nz(e)){if(r.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else(!rz(e)||e.indexOf(".")!==-1&&!String(r.Endpoint).startsWith("http:")||e.toLowerCase()!==e||e.length<3)&&(r.ForcePathStyle=!0);return r.DisableMultiRegionAccessPoints&&(r.disableMultiRegionAccessPoints=!0,r.DisableMRAP=!0),r},Z$=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,ez=/(\d+\.){3}\d+/,tz=/\.\./,rz=r=>Z$.test(r)&&!ez.test(r)&&!tz.test(r),nz=r=>{const[e,t,n,,,i]=r.split(":"),a=e==="arn"&&r.split(":").length>=6,s=!!(a&&t&&n&&i);if(a&&!s)throw new Error(`Invalid ARN: ${r} was an invalid ARN.`);return s},iz=(r,e,t,n=!1)=>{const i=async()=>{let a;return n?a=t.clientContextParams?.[r]??t[r]??t[e]:a=t[r]??t[e],typeof a=="function"?a():a};return r==="credentialScope"||e==="CredentialScope"?async()=>{const a=typeof t.credentials=="function"?await t.credentials():t.credentials;return a?.credentialScope??a?.CredentialScope}:r==="accountId"||e==="AccountId"?async()=>{const a=typeof t.credentials=="function"?await t.credentials():t.credentials;return a?.accountId??a?.AccountId}:r==="endpoint"||e==="endpoint"?async()=>{if(t.isCustomEndpoint===!1)return;const a=await i();if(a&&typeof a=="object"){if("url"in a)return a.url.href;if("hostname"in a){const{protocol:s,hostname:o,port:l,path:u}=a;return`${s}//${o}${l?":"+l:""}${u}`}}return a}:i};function az(r){return async(e,t,n,i)=>{if(!n.isCustomEndpoint){let o;n.serviceConfiguredEndpoint?o=await n.serviceConfiguredEndpoint():o=await r(n.serviceId),o&&(n.endpoint=()=>Promise.resolve(J1(o)),n.isCustomEndpoint=!0)}const a=await sz(e,t,n);if(typeof n.endpointProvider!="function")throw new Error("config.endpointProvider is not set.");const s=n.endpointProvider(a,i);if(n.isCustomEndpoint&&n.endpoint){const o=await n.endpoint();if(o?.headers){s.headers??={};for(const[l,u]of Object.entries(o.headers))s.headers[l]=Array.isArray(u)?u:[u]}}return s}}const sz=async(r,e,t)=>{const n={},i=e?.getEndpointParameterInstructions?.()||{};for(const[a,s]of Object.entries(i))switch(s.type){case"staticContextParams":n[a]=s.value;break;case"contextParams":n[a]=r[s.name];break;case"clientContextParams":case"builtInParams":n[a]=await iz(s.name,a,t,s.type!=="builtInParams")();break;case"operationContextParams":n[a]=s.get(r);break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(s))}return Object.keys(i).length===0&&Object.assign(n,t),String(t.serviceId).toLowerCase()==="s3"&&await K$(n),n};function oz(r,e,t){r.__smithy_context?r.__smithy_context.features||(r.__smithy_context.features={}):r.__smithy_context={features:{}},r.__smithy_context.features[e]=t}function lz(r){const e=az(r);return({config:t,instructions:n})=>(i,a)=>async s=>{t.isCustomEndpoint&&oz(a,"ENDPOINT_OVERRIDE","N");const o=await e(s.input,{getEndpointParameterInstructions(){return n}},{...t},a);a.endpointV2=o,a.authSchemes=o.properties?.authSchemes;const l=a.authSchemes?.[0];if(l){a.signing_region=l.signingRegion,a.signing_service=l.signingName;const c=Ac(a)?.selectedHttpAuthScheme?.httpAuthOption;c&&(c.signingProperties=Object.assign(c.signingProperties||{},{signing_region:l.signingRegion,signingRegion:l.signingRegion,signing_service:l.signingName,signingName:l.signingName,signingRegionSet:l.signingRegionSet},l.properties))}return i({...s})}}const uz={name:"serializerMiddleware"},cz={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:uz.name};function dz(r){const e=lz(r);return(t,n)=>({applyToStack:i=>{i.addRelativeTo(e({config:t,instructions:n}),cz)}})}function fz(r){return e=>{const t=e.tls??!0,{endpoint:n,useDualstackEndpoint:i,useFipsEndpoint:a}=e,s=n!=null?async()=>J1(await _s(n)()):void 0,l=Object.assign(e,{endpoint:s,tls:t,isCustomEndpoint:!!n,useDualstackEndpoint:_s(i??!1),useFipsEndpoint:_s(a??!1)});let u;return l.serviceConfiguredEndpoint=async()=>(e.serviceId&&!u&&(u=r(e.serviceId)),u),l}}class eb{nodes;root;conditions;results;constructor(e,t,n,i){this.nodes=e,this.root=t,this.conditions=n,this.results=i}static from(e,t,n,i){return new eb(e,t,n,i)}}class hz{capacity;data=new Map;parameters=[];constructor({size:e,params:t}){this.capacity=e??50,t&&(this.parameters=t)}get(e,t){const n=this.hash(e);if(n===!1)return t();if(!this.data.has(n)){if(this.data.size>this.capacity+10){const i=this.data.keys();let a=0;for(;;){const{value:s,done:o}=i.next();if(this.data.delete(s),o||++a>10)break}}this.data.set(n,t())}return this.data.get(n)}size(){return this.data.size}hash(e){let t="";const{parameters:n}=this;if(n.length===0)return!1;for(const i of n){const a=String(e[i]??"");if(a.includes("|;"))return!1;t+=a+"|;"}return t}}class _a extends Error{constructor(e){super(e),this.name="EndpointError"}}const pz="endpoints";function Ig(r){return typeof r!="object"||r==null?r:"ref"in r?`$${Ig(r.ref)}`:"fn"in r?`${r.fn}(${(r.argv||[]).map(Ig).join(", ")})`:JSON.stringify(r,null,2)}const tb={},gz=(r,e)=>r===e;function mz(...r){for(const e of r)if(e!=null)return e}const yz=r=>{const e=r.split("."),t=[];for(const n of e){const i=n.indexOf("[");if(i!==-1){if(n.indexOf("]")!==n.length-1)throw new _a(`Path: '${r}' does not end with ']'`);const a=n.slice(i+1,-1);if(Number.isNaN(parseInt(a)))throw new _a(`Invalid array index: '${a}' in path: '${r}'`);i!==0&&t.push(n.slice(0,i)),t.push(a)}else t.push(n)}return t},gP=(r,e)=>yz(e).reduce((t,n)=>{if(typeof t!="object")throw new _a(`Index '${n}' in '${e}' not found in '${JSON.stringify(r)}'`);if(Array.isArray(t)){const i=parseInt(n);return t[i<0?t.length+i:i]}return t[n]},r),vz=r=>r!=null;function Az(r,e,t){return r?e:t}const bz=r=>!r,wz=new RegExp("^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$"),mP=r=>wz.test(r)||r.startsWith("[")&&r.endsWith("]"),qy={[Tf.HTTP]:80,[Tf.HTTPS]:443},xz=r=>{const e=(()=>{try{if(r instanceof URL)return r;if(typeof r=="object"&&"hostname"in r){const{hostname:d,port:h,protocol:g="",path:y="",query:v={}}=r,A=new URL(`${g}//${d}${h?`:${h}`:""}${y}`);return A.search=Object.entries(v).map(([x,S])=>`${x}=${S}`).join("&"),A}return new URL(r)}catch{return null}})();if(!e)return console.error(`Unable to parse ${JSON.stringify(r)} as a whatwg URL.`),null;const t=e.href,{host:n,hostname:i,pathname:a,protocol:s,search:o}=e;if(o)return null;const l=s.slice(0,-1);if(!Object.values(Tf).includes(l))return null;const u=mP(i),c=t.includes(`${n}:${qy[l]}`)||typeof r=="string"&&r.includes(`${n}:${qy[l]}`),f=`${n}${c?`:${qy[l]}`:""}`;return{scheme:l,authority:f,path:a,normalizedPath:a.endsWith("/")?a:`${a}/`,isIp:u}};function Cz(r,e,t){if(t===1)return[r];if(r==="")return[""];const n=r.split(e);return t===0?n:n.slice(0,t-1).concat(n.slice(1).join(e))}const Sz=(r,e)=>r===e,Ez=(r,e,t,n)=>r==null||e>=t||r.length<t||/[^\u0000-\u007f]/.test(r)?null:n?r.substring(r.length-t,r.length-e):r.substring(e,t),kz=r=>encodeURIComponent(r).replace(/[!*'()]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),Tz={booleanEquals:gz,coalesce:mz,getAttr:gP,isSet:vz,isValidHostLabel:nm,ite:Az,not:bz,parseURL:xz,split:Cz,stringEquals:Sz,substring:Ez,uriEncode:kz},yP=(r,e)=>{const t=[],{referenceRecord:n,endpointParams:i}=e;let a=0;for(;a<r.length;){const s=r.indexOf("{",a);if(s===-1){t.push(r.slice(a));break}t.push(r.slice(a,s));const o=r.indexOf("}",s);if(o===-1){t.push(r.slice(s));break}r[s+1]==="{"&&r[o+1]==="}"&&(t.push(r.slice(s+1,o)),a=o+2);const l=r.substring(s+1,o);if(l.includes("#")){const[u,c]=l.split("#");t.push(gP(n[u]??i[u],c))}else t.push(n[l]??i[l]);a=o+1}return t.join("")},Fz=({ref:r},e)=>e.referenceRecord[r]??e.endpointParams[r],om=(r,e,t)=>{if(typeof r=="string")return yP(r,t);if(r.fn)return AP.callFunction(r,t);if(r.ref)return Fz(r,t);throw new _a(`'${e}': ${String(r)} is not a string, function or reference.`)},vP=({fn:r,argv:e},t)=>{const n=Array(e.length);for(let s=0;s<n.length;++s){const o=e[s];typeof o=="boolean"||typeof o=="number"?n[s]=o:n[s]=AP.evaluateExpression(o,"arg",t)}const i=r.indexOf(".");if(i!==-1){const o=tb[r.slice(0,i)]?.[r.slice(i+1)];if(typeof o=="function")return o(...n)}const a=Tz[r];if(typeof a=="function")return a(...n);throw new Error(`function ${r} not loaded in endpointFunctions.`)},AP={evaluateExpression:om,callFunction:vP},Iz=(r,e)=>{const{assign:t}=r;if(t&&t in e.referenceRecord)throw new _a(`'${t}' is already defined in Reference Record.`);const n=vP(r,e);e.logger?.debug?.(`${pz} evaluateCondition: ${Ig(r)} = ${Ig(n)}`);const i=n===""?!0:!!n;return t!=null?{result:i,toAssign:{name:t,value:n}}:{result:i}},Pz=(r,e)=>Object.entries(r??{}).reduce((t,[n,i])=>(t[n]=i.map(a=>{const s=om(a,"Header value entry",e);if(typeof s!="string")throw new _a(`Header '${n}' value '${s}' is not a string`);return s}),t),{}),bP=(r,e)=>Object.entries(r).reduce((t,[n,i])=>(t[n]=xP.getEndpointProperty(i,e),t),{}),wP=(r,e)=>{if(Array.isArray(r))return r.map(t=>wP(t,e));switch(typeof r){case"string":return yP(r,e);case"object":if(r===null)throw new _a(`Unexpected endpoint property: ${r}`);return xP.getEndpointProperties(r,e);case"boolean":return r;default:throw new _a(`Unexpected endpoint property type: ${typeof r}`)}},xP={getEndpointProperty:wP,getEndpointProperties:bP},Dz=(r,e)=>{const t=om(r,"Endpoint URL",e);if(typeof t=="string")try{return new URL(t)}catch(n){throw console.error(`Failed to construct URL with ${t}`,n),n}throw new _a(`Endpoint URL must be a string, got ${typeof t}`)},Wy=1e8,Rz=(r,e)=>{const{nodes:t,root:n,results:i,conditions:a}=r;let s=n;const o={},l={referenceRecord:o,endpointParams:e.endpointParams,logger:e.logger};for(;s!==1&&s!==-1&&s<Wy;){const u=3*(Math.abs(s)-1),[c,f,d]=[t[u],t[u+1],t[u+2]],[h,g,y]=a[c],v=Iz({fn:h,assign:y,argv:g},l);if(v.toAssign){const{name:A,value:x}=v.toAssign;o[A]=x}s=s>=0===v.result?f:d}if(s>=Wy){const u=i[s-Wy];if(u[0]===-1){const[,h]=u;throw new _a(om(h,"Error",l))}const[c,f,d]=u;return{url:Dz(c,l),properties:bP(f,l),headers:Pz(d??{},l)}}throw new _a("No matching endpoint.")},Oz=fz(pP),CP=dz(pP);class Qy extends C$(am,Pl,Tg,im){}const Bz=r=>crypto.getRandomValues(r),SP=S$(Bz),Mz=SP,PA=async(r=new Uint8Array,e)=>{if(r instanceof Uint8Array)return Qy.mutate(r);if(!r)return Qy.mutate(new Uint8Array);const t=e.streamCollector(r);return Qy.mutate(await t)};class _z{serdeContext;setSerdeContext(e){this.serdeContext=e}}class Nz extends _z{options;compositeErrorRegistry;constructor(e){super(),this.options=e,this.compositeErrorRegistry=ta.for(e.defaultNamespace);for(const t of e.errorTypeRegistries??[])this.compositeErrorRegistry.copyFrom(t)}getRequestType(){return aa}getResponseType(){return oc}setSerdeContext(e){this.serdeContext=e,this.serializer.setSerdeContext(e),this.deserializer.setSerdeContext(e),this.getPayloadCodec()&&this.getPayloadCodec().setSerdeContext(e)}updateServiceEndpoint(e,t){if("url"in t){e.protocol=t.url.protocol,e.hostname=t.url.hostname,e.port=t.url.port?Number(t.url.port):void 0,e.path=t.url.pathname,e.fragment=t.url.hash||void 0,e.username=t.url.username||void 0,e.password=t.url.password||void 0,e.query||(e.query={});for(const[n,i]of t.url.searchParams.entries())e.query[n]=i;if(t.headers)for(const n in t.headers)e.headers[n]=t.headers[n].join(", ");return e}else{if(e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port?Number(t.port):void 0,e.path=t.path,e.query={...t.query},t.headers)for(const n in t.headers)e.headers[n]=t.headers[n];return e}}setHostPrefix(e,t,n){if(this.serdeContext?.disableHostPrefix)return;const i=yi.of(t.input),a=jd(t.traits??{});if(a.endpoint){let s=a.endpoint?.[0];if(typeof s=="string"){for(const[o,l]of i.structIterator()){if(!l.getMergedTraits().hostLabel)continue;const u=n[o];if(typeof u!="string")throw new Error(`@smithy/core/schema - ${o} in input must be a string as hostLabel.`);s=s.replace(`{${o}}`,u)}e.hostname=s+e.hostname}}}deserializeMetadata(e){return{httpStatusCode:e.statusCode,requestId:e.headers["x-amzn-requestid"]??e.headers["x-amzn-request-id"]??e.headers["x-amz-request-id"],extendedRequestId:e.headers["x-amz-id-2"],cfId:e.headers["x-amz-cf-id"]}}async serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n}){return(await this.loadEventStreamCapability()).serializeEventStream({eventStream:e,requestSchema:t,initialRequest:n})}async deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n}){return(await this.loadEventStreamCapability()).deserializeEventStream({response:e,responseSchema:t,initialResponseContainer:n})}async loadEventStreamCapability(){const{EventStreamSerde:e,eventStreamSerdeProvider:t}=await Promise.resolve().then(()=>require("./index.browser-1pbIT4ky.cjs")),n=this.resolveEventStreamMarshaller(t);return new e({marshaller:n,serializer:this.serializer,deserializer:this.deserializer,serdeContext:this.serdeContext,defaultContentType:this.getDefaultContentType()})}resolveEventStreamMarshaller(e){const t=this.serdeContext;return t.eventStreamMarshaller?t.eventStreamMarshaller:e(this.serdeContext)}getDefaultContentType(){throw new Error(`@smithy/core/protocols - ${this.constructor.name} getDefaultContentType() implementation missing.`)}async deserializeHttpMessage(e,t,n,i,a){return[]}getEventStreamMarshaller(){const e=this.serdeContext;if(!e.eventStreamMarshaller)throw new Error("@smithy/core - HttpProtocol: eventStreamMarshaller missing in serdeContext.");return e.eventStreamMarshaller}}class Lz extends Nz{async serializeRequest(e,t,n){const i=this.serializer,a={},s={},o=await n.endpoint(),l=yi.of(e?.input),u=l.getSchema();let c;const f=t&&typeof t=="object"?t:{},d=new aa({protocol:"",hostname:"",port:void 0,path:"/",fragment:void 0,query:a,headers:s,body:void 0});if(o&&(this.updateServiceEndpoint(d,o),this.setHostPrefix(d,e,f)),f){const h=l.getEventStreamMember();if(h){if(f[h]){const g={};for(const[y,v]of l.structIterator())y!==h&&f[y]&&(i.write(v,f[y]),g[y]=i.flush());c=await this.serializeEventStream({eventStream:f[h],requestSchema:l,initialRequest:g})}}else i.write(u,f),c=i.flush()}return d.headers=Object.assign(d.headers,s),d.query=a,d.body=c,d.method="POST",d}async deserializeResponse(e,t,n){const i=this.deserializer,a=yi.of(e.output),s={};if(n.statusCode>=300){const l=await PA(n.body,t);throw l.byteLength>0&&Object.assign(s,await i.read(15,l)),await this.handleError(e,t,n,s,this.deserializeMetadata(n)),new Error("@smithy/core/protocols - RPC Protocol error handler failed to throw.")}for(const l in n.headers){const u=n.headers[l];delete n.headers[l],n.headers[l.toLowerCase()]=u}const o=a.getEventStreamMember();if(o)s[o]=await this.deserializeEventStream({response:n,responseSchema:a,initialResponseContainer:s});else{const l=await PA(n.body,t);l.byteLength>0&&Object.assign(s,await i.read(a,l))}return s.$metadata=this.deserializeMetadata(n),s}}function EP(r,e){if(e.timestampFormat.useTrait&&r.isTimestampSchema()&&(r.getSchema()===5||r.getSchema()===6||r.getSchema()===7))return r.getSchema();const{httpLabel:t,httpPrefixHeaders:n,httpHeader:i,httpQuery:a}=r.getMergedTraits();return(e.httpBindings?typeof n=="string"||i?6:a||t?5:void 0:void 0)??e.timestampFormat.default}const Uz=r=>({setHttpHandler(e){r.httpHandler=e},httpHandler(){return r.httpHandler},updateHttpClientConfig(e,t){r.httpHandler?.updateHttpClientConfig(e,t)},httpHandlerConfigs(){return r.httpHandler.httpHandlerConfigs()}}),Vz=r=>({httpHandler:r.httpHandler()}),ZE="content-length";function $z(r){return e=>async t=>{const n=t.request;if(aa.isInstance(n)){const{body:i,headers:a}=n;if(i&&Object.keys(a).map(s=>s.toLowerCase()).indexOf(ZE)===-1)try{const s=r(i);n.headers={...n.headers,[ZE]:String(s)}}catch{}}return e({...t,request:n})}}const zz={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},Hz=r=>({applyToStack:e=>{e.add($z(r.bodyLengthChecker),zz)}}),kl=r=>encodeURIComponent(r).replace(/[!'()*]/g,Gz),Gz=r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`;function jz(r){const e=[];for(let t of Object.keys(r).sort()){const n=r[t];if(t=kl(t),Array.isArray(n))for(let i=0,a=n.length;i<a;i++)e.push(`${t}=${kl(n[i])}`);else{let i=t;(n||typeof n=="string")&&(i+=`=${kl(n)}`),e.push(i)}}return e.join("&")}const qz=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Wz=["TimeoutError","RequestTimeout","RequestTimeoutException"],Qz=[500,502,503,504],Yz=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"],Xz=["EHOSTUNREACH","ENETUNREACH","ENOTFOUND","EAI_AGAIN"],Jz=r=>r?.$retryable!==void 0,Kz=r=>r.$metadata?.clockSkewCorrected,Zz=r=>{const e=new Set(["Failed to fetch","NetworkError when attempting to fetch resource","The Internet connection appears to be offline","Load failed","Network request failed"]);return r&&r instanceof TypeError?e.has(r.message):!1},kP=r=>r.$metadata?.httpStatusCode===429||qz.includes(r.name)||r.$retryable?.throttling==!0,rb=(r,e=0)=>Jz(r)||Kz(r)||r.name==="InvalidSignatureException"&&r.message?.includes("Signature expired")||Wz.includes(r.name)||Yz.includes(r?.code||"")||Xz.includes(r?.code||"")||Qz.includes(r.$metadata?.httpStatusCode||0)||Zz(r)||tH(r)||r.cause!==void 0&&e<=10&&rb(r.cause,e+1),eH=r=>{if(r.$metadata?.httpStatusCode!==void 0){const e=r.$metadata.httpStatusCode;return 500<=e&&e<=599&&!rb(r)}return!1};function tH(r){return r.code==="ERR_HTTP2_STREAM_ERROR"&&r.message.includes("NGHTTP2_REFUSED_STREAM")}const TP=20*1e3,e2=500,rH=1,nH="amz-sdk-invocation-id",iH="amz-sdk-request";function aH(r,e){if(oc.isInstance(r))for(const t of Object.keys(r.headers)){const n=t.toLowerCase();if(n==="retry-after"){const i=r.headers[t];let a=NaN;if(i.endsWith("GMT"))try{a=(dP(i).getTime()-Date.now())/1e3}catch(s){e?.trace?.("Failed to parse retry-after header"),e?.trace?.(s)}else i.match(/ GMT, ((\d+)|(\d+\.\d+))$/)?a=Number(i.match(/ GMT, ([\d.]+)$/)?.[1]):i.match(/^((\d+)|(\d+\.\d+))$/)?a=Number(i):Date.parse(i)>=Date.now()&&(a=(Date.parse(i)-Date.now())/1e3);return isNaN(a)?void 0:new Date(Date.now()+a*1e3)}else if(n==="x-amz-retry-after"){const i=r.headers[t],a=Number(i);if(isNaN(a)){e?.trace?.(`Failed to parse x-amz-retry-after=${i}`);return}return new Date(Date.now()+a)}}}const sH=r=>r instanceof Error?r:r instanceof Object?Object.assign(new Error,r):typeof r=="string"?new Error(r):new Error(`AWS SDK error wrapper for ${r}`);function oH(r){return e=>(t,n)=>async i=>{let a=await e.retryStrategy();const s=await e.maxAttempts();if(uH(a)){a=a;let o=await a.acquireInitialRetryToken((n.partition_id??"")+(n.__retryLongPoll?":longpoll":"")),l=new Error,u=0,c=0;const{request:f}=i,d=aa.isInstance(f);for(d&&(f.headers[nH]=SP());;)try{d&&(f.headers[iH]=`attempt=${u+1}; max=${s}`);const{response:h,output:g}=await t(i);return a.recordSuccess(o),g.$metadata.attempts=u+1,g.$metadata.totalRetryDelay=c,{response:h,output:g}}catch(h){const g=cH(h,e.logger);if(l=sH(h),d&&r(f))throw(n.logger instanceof lP?console:n.logger)?.warn("An error was encountered in a non-retryable streaming request."),l;try{o=await a.refreshRetryTokenForRetry(o,g)}catch{throw l.$metadata||(l.$metadata={}),l.$metadata.attempts=u+1,l.$metadata.totalRetryDelay=c,l}u=o.getRetryCount();const y=o.getRetryDelay();c+=(o?.$retryLog?.acquisitionDelay??0)+y,y>0&&await lH(y)}}else return a=a,a?.mode&&(n.userAgent=[...n.userAgent||[],["cfg/retry-mode",a.mode]]),a.retry(t,i)}}const lH=r=>new Promise(e=>setTimeout(e,r)),uH=r=>typeof r.acquireInitialRetryToken<"u"&&typeof r.refreshRetryTokenForRetry<"u"&&typeof r.recordSuccess<"u",cH=(r,e)=>{const t={error:r,errorType:dH(r)},n=aH(r.$response,e);return n&&(t.retryAfterHint=n),t},dH=r=>kP(r)?"THROTTLING":rb(r)?"TRANSIENT":eH(r)?"SERVER_ERROR":"CLIENT_ERROR",fH={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0};function hH(r){const e=oH(r);return t=>({applyToStack:n=>{n.add(e(t),fH)}})}class nb{static setTimeoutFn=(e,t)=>setTimeout(e,t);beta;minCapacity;minFillRate;scaleConstant;smooth;enabled=!1;availableTokens=0;lastMaxRate=0;measuredTxRate=0;requestCount=0;fillRate;lastThrottleTime;lastTimestamp=0;lastTxRateBucket;maxCapacity;timeWindow=0;constructor(e){this.beta=e?.beta??.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??.5,this.scaleConstant=e?.scaleConstant??.4,this.smooth=e?.smooth??.8,this.lastThrottleTime=this.getCurrentTimeInSeconds(),this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}async getSendToken(){return this.acquireTokenBucket(1)}updateClientSendingRate(e){let t;this.updateMeasuredRate();const n=e;if(n?.errorType==="THROTTLING"||kP(n?.error??e)){const s=this.enabled?Math.min(this.measuredTxRate,this.fillRate):this.measuredTxRate;this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),t=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),t=this.cubicSuccess(this.getCurrentTimeInSeconds());const a=Math.min(t,2*this.measuredTxRate);this.updateTokenBucketRate(a)}getCurrentTimeInSeconds(){return Date.now()/1e3}async acquireTokenBucket(e){if(this.enabled){for(this.refillTokenBucket();e>this.availableTokens;){const t=(e-this.availableTokens)/this.fillRate*1e3;await new Promise(n=>nb.setTimeoutFn(n,t)),this.refillTokenBucket()}this.availableTokens=this.availableTokens-e}}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const t=(e-this.lastTimestamp)*this.fillRate;this.availableTokens=Math.min(this.maxCapacity,this.availableTokens+t),this.lastTimestamp=e}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,1/3))}cubicThrottle(e){return this.getPrecise(e*this.beta)}cubicSuccess(e){return this.getPrecise(this.scaleConstant*Math.pow(e-this.lastThrottleTime-this.timeWindow,3)+this.lastMaxRate)}enableTokenBucket(){this.enabled=!0}updateTokenBucketRate(e){this.refillTokenBucket(),this.fillRate=Math.max(e,this.minFillRate),this.maxCapacity=Math.max(e,this.minCapacity),this.availableTokens=Math.min(this.availableTokens,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),t=Math.floor(e*2)/2;if(this.requestCount++,t>this.lastTxRateBucket){const n=this.requestCount/(t-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(n*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=t}}getPrecise(e){return parseFloat(e.toFixed(8))}}class ki{static v2026=typeof process<"u"&&process.env?.SMITHY_NEW_RETRIES_2026==="true";static delay(){return ki.v2026?50:100}static throttlingDelay(){return ki.v2026?1e3:500}static cost(){return ki.v2026?14:5}static throttlingCost(){return ki.v2026?5:10}static modifiedCostType(){return ki.v2026?"THROTTLING":"TRANSIENT"}}class pH{x=ki.delay();computeNextBackoffDelay(e){const i=Math.random()*Math.min(this.x*2**e,TP);return Math.floor(i)}setDelayBase(e){this.x=e}}class t2{delay;count;cost;longPoll;$retryLog={acquisitionDelay:0};constructor(e,t,n,i){this.delay=e,this.count=t,this.cost=n,this.longPoll=i}getRetryCount(){return this.count}getRetryDelay(){return Math.min(TP,this.delay)}getRetryCost(){return this.cost}isLongPoll(){return this.longPoll}}var Bo;(function(r){r.STANDARD="standard",r.ADAPTIVE="adaptive"})(Bo||(Bo={}));const nf=3,gH=Bo.STANDARD,Ip={incompatible:1,attempts:2,capacity:3};class DA{mode=Bo.STANDARD;retryBackoffStrategy;capacity=e2;maxAttemptsProvider;baseDelay;constructor(e){typeof e=="number"?this.maxAttemptsProvider=async()=>e:typeof e=="function"?this.maxAttemptsProvider=e:e&&typeof e=="object"&&(this.maxAttemptsProvider=async()=>e.maxAttempts,this.baseDelay=e.baseDelay,this.retryBackoffStrategy=e.backoff),this.maxAttemptsProvider??=async()=>nf,this.baseDelay??=ki.delay(),this.retryBackoffStrategy??=new pH}async acquireInitialRetryToken(e){return new t2(ki.delay(),0,void 0,ki.v2026&&e.includes(":longpoll"))}async refreshRetryTokenForRetry(e,t){const n=await this.getMaxAttempts(),i=this.retryCode(e,t,n),a=i===0,s=e.isLongPoll?.();if(a||s){const o=t.errorType;this.retryBackoffStrategy.setDelayBase(o==="THROTTLING"?ki.throttlingDelay():this.baseDelay);const l=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount());let u=l;if(t.retryAfterHint instanceof Date&&(u=Math.max(l,Math.min(t.retryAfterHint.getTime()-Date.now(),l+5e3))),a){const c=this.getCapacityCost(o);this.capacity-=c;const f=new t2(0,e.getRetryCount()+1,c,e.isLongPoll?.()??!1);return await new Promise(d=>setTimeout(d,u)),f.$retryLog.acquisitionDelay=u,f}else{const c=ki.v2026&&i===Ip.capacity&&s?u:0;c>0&&await new Promise(f=>setTimeout(f,c))}}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.min(e2,this.capacity+(e.getRetryCost()??rH))}getCapacity(){return this.capacity}async maxAttempts(){return this.maxAttemptsProvider()}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch{return console.warn(`Max attempts provider could not resolve. Using default of ${nf}`),nf}}retryCode(e,t,n){const i=e.getRetryCount()+1,a=this.isRetryableError(t.errorType)?0:Ip.incompatible,s=i<n?0:Ip.attempts,o=this.capacity>=this.getCapacityCost(t.errorType)?0:Ip.capacity;return a||s||o}getCapacityCost(e){return e===ki.modifiedCostType()?ki.throttlingCost():ki.cost()}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class mH{mode=Bo.ADAPTIVE;rateLimiter;standardRetryStrategy;constructor(e,t){const{rateLimiter:n}=t??{};this.rateLimiter=n??new nb,this.standardRetryStrategy=t?new DA({maxAttempts:typeof e=="number"?e:3,...t}):new DA(e)}async acquireInitialRetryToken(e){const t=await this.standardRetryStrategy.acquireInitialRetryToken(e);return await this.rateLimiter.getSendToken(),t}async refreshRetryTokenForRetry(e,t){this.rateLimiter.updateClientSendingRate(t);const n=await this.standardRetryStrategy.refreshRetryTokenForRetry(e,t);return await this.rateLimiter.getSendToken(),n}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}async maxAttemptsProvider(){return this.standardRetryStrategy.maxAttempts()}}const yH=(r,e)=>{const{retryStrategy:t,retryMode:n}=r,{defaultMaxAttempts:i=nf,defaultBaseDelay:a=ki.delay()}={},s=_s(r.maxAttempts??i);let o=t?Promise.resolve(t):void 0;const l=async()=>{const u=await s();return await _s(n)()===Bo.ADAPTIVE?new mH(s,{maxAttempts:u,baseDelay:a}):new DA({maxAttempts:u,baseDelay:a})};return Object.assign(r,{maxAttempts:s,retryStrategy:()=>o??=l()})},vH=hH(t$);ki.v2026||=typeof process=="object"&&process.env?.AWS_NEW_RETRIES_2026==="true";function Ds(r,e,t){r.__aws_sdk_context?r.__aws_sdk_context.features||(r.__aws_sdk_context.features={}):r.__aws_sdk_context={features:{}},r.__aws_sdk_context.features[e]=t}const AH=r=>e=>async t=>{if(!aa.isInstance(t.request))return e(t);const{request:n}=t,{handlerProtocol:i=""}=r.requestHandler.metadata||{};if(i.indexOf("h2")>=0&&!n.headers[":authority"])delete n.headers.host,n.headers[":authority"]=n.hostname+(n.port?":"+n.port:"");else if(!n.headers.host){let a=n.hostname;n.port!=null&&(a+=`:${n.port}`),n.headers.host=a}return e(t)},bH={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},wH=r=>({applyToStack:e=>{e.add(AH(r),bH)}}),xH=()=>(r,e)=>async t=>{try{const n=await r(t),{clientName:i,commandName:a,logger:s,dynamoDbDocumentClientOptions:o={}}=e,{overrideInputFilterSensitiveLog:l,overrideOutputFilterSensitiveLog:u}=o,c=l??e.inputFilterSensitiveLog,f=u??e.outputFilterSensitiveLog,{$metadata:d,...h}=n.output;return s?.info?.({clientName:i,commandName:a,input:c(t.input),output:f(h),metadata:d}),n}catch(n){const{clientName:i,commandName:a,logger:s,dynamoDbDocumentClientOptions:o={}}=e,{overrideInputFilterSensitiveLog:l}=o,u=l??e.inputFilterSensitiveLog;throw s?.error?.({clientName:i,commandName:a,input:u(t.input),error:n,metadata:n.$metadata}),n}},CH={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},SH=r=>({applyToStack:e=>{e.add(xH(),CH)}}),EH=r=>({applyToStack:e=>{}}),kH=(r,e)=>{if(!e||e.length===0)return r;const t=[];for(const n of e)for(const i of r)i.schemeId.split("#")[1]===n&&t.push(i);for(const n of r)t.find(({schemeId:i})=>i===n.schemeId)||t.push(n);return t};function TH(r){const e=new Map;for(const t of r)e.set(t.schemeId,t);return e}const FH=(r,e)=>(t,n)=>async i=>{const a=r.httpAuthSchemeProvider(await e.httpAuthSchemeParametersProvider(r,n,i.input)),s=r.authSchemePreference?await r.authSchemePreference():[],o=kH(a,s),l=TH(r.httpAuthSchemes),u=Ac(n),c=[];for(const f of o){const d=l.get(f.schemeId);if(!d){c.push(`HttpAuthScheme \`${f.schemeId}\` was not enabled for this service.`);continue}const h=d.identityProvider(await e.identityProviderConfigProvider(r));if(!h){c.push(`HttpAuthScheme \`${f.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:g={},signingProperties:y={}}=f.propertiesExtractor?.(r,n)||{};f.identityProperties=Object.assign(f.identityProperties||{},g),f.signingProperties=Object.assign(f.signingProperties||{},y),u.selectedHttpAuthScheme={httpAuthOption:f,identity:await h(f.identityProperties),signer:d.signer};break}if(!u.selectedHttpAuthScheme)throw new Error(c.join(`
|
|
3053
|
+
`));return t(i)},IH={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:"endpointV2Middleware"},PH=(r,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t})=>({applyToStack:n=>{n.addRelativeTo(FH(r,{httpAuthSchemeParametersProvider:e,identityProviderConfigProvider:t}),IH)}}),DH=r=>e=>{throw e},RH=(r,e)=>{},OH=r=>(e,t)=>async n=>{if(!aa.isInstance(n.request))return e(n);const a=Ac(t).selectedHttpAuthScheme;if(!a)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:s={}},identity:o,signer:l}=a,u=await e({...n,request:await l.sign(n.request,o,s)}).catch((l.errorHandler||DH)(s));return(l.successHandler||RH)(u.response,s),u},BH={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:"retryMiddleware"},MH=r=>({applyToStack:e=>{e.addRelativeTo(OH(),BH)}}),af=r=>{if(typeof r=="function")return r;const e=Promise.resolve(r);return()=>e};class _H{authSchemes=new Map;constructor(e){for(const t in e){const n=e[t];n!==void 0&&this.authSchemes.set(t,n)}}getIdentityProvider(e){return this.authSchemes.get(e)}}class NH{async sign(e,t,n){return e}}const LH=r=>function(t){return FP(t)&&t.expiration.getTime()-Date.now()<r},UH=3e5,VH=LH(UH),FP=r=>r.expiration!==void 0,$H=(r,e,t)=>{if(r===void 0)return;const n=typeof r!="function"?async()=>Promise.resolve(r):r;let i,a,s,o=!1;const l=async u=>{a||(a=n(u));try{i=await a,s=!0,o=!1}finally{a=void 0}return i};return e===void 0?async u=>((!s||u?.forceRefresh)&&(i=await l(u)),i):async u=>((!s||u?.forceRefresh)&&(i=await l(u)),o?i:t(i)?(e(i)&&await l(u),i):(o=!0,i))},zH=void 0;function HH(r){return r===void 0?!0:typeof r=="string"&&r.length<=50}function GH(r){const e=af(r.userAgentAppId??zH),{customUserAgent:t}=r;return Object.assign(r,{customUserAgent:typeof t=="string"?[[t]]:t,userAgentAppId:async()=>{const n=await e();if(!HH(n)){const i=r.logger?.constructor?.name==="NoOpLogger"||!r.logger?console:r.logger;typeof n!="string"?i?.warn("userAgentAppId must be a string or undefined."):n.length>50&&i?.warn("The provided userAgentAppId exceeds the maximum length of 50 characters.")}return n}})}const jH={partitions:[{id:"aws",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-east-1",name:"aws",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"ap-east-2":{description:"Asia Pacific (Taipei)"},"ap-northeast-1":{description:"Asia Pacific (Tokyo)"},"ap-northeast-2":{description:"Asia Pacific (Seoul)"},"ap-northeast-3":{description:"Asia Pacific (Osaka)"},"ap-south-1":{description:"Asia Pacific (Mumbai)"},"ap-south-2":{description:"Asia Pacific (Hyderabad)"},"ap-southeast-1":{description:"Asia Pacific (Singapore)"},"ap-southeast-2":{description:"Asia Pacific (Sydney)"},"ap-southeast-3":{description:"Asia Pacific (Jakarta)"},"ap-southeast-4":{description:"Asia Pacific (Melbourne)"},"ap-southeast-5":{description:"Asia Pacific (Malaysia)"},"ap-southeast-6":{description:"Asia Pacific (New Zealand)"},"ap-southeast-7":{description:"Asia Pacific (Thailand)"},"aws-global":{description:"aws global region"},"ca-central-1":{description:"Canada (Central)"},"ca-west-1":{description:"Canada West (Calgary)"},"eu-central-1":{description:"Europe (Frankfurt)"},"eu-central-2":{description:"Europe (Zurich)"},"eu-north-1":{description:"Europe (Stockholm)"},"eu-south-1":{description:"Europe (Milan)"},"eu-south-2":{description:"Europe (Spain)"},"eu-west-1":{description:"Europe (Ireland)"},"eu-west-2":{description:"Europe (London)"},"eu-west-3":{description:"Europe (Paris)"},"il-central-1":{description:"Israel (Tel Aviv)"},"me-central-1":{description:"Middle East (UAE)"},"me-south-1":{description:"Middle East (Bahrain)"},"mx-central-1":{description:"Mexico (Central)"},"sa-east-1":{description:"South America (Sao Paulo)"},"us-east-1":{description:"US East (N. Virginia)"},"us-east-2":{description:"US East (Ohio)"},"us-west-1":{description:"US West (N. California)"},"us-west-2":{description:"US West (Oregon)"}}},{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn",dualStackDnsSuffix:"api.amazonwebservices.com.cn",implicitGlobalRegion:"cn-northwest-1",name:"aws-cn",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:{"aws-cn-global":{description:"aws-cn global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{id:"aws-eusc",outputs:{dnsSuffix:"amazonaws.eu",dualStackDnsSuffix:"api.amazonwebservices.eu",implicitGlobalRegion:"eusc-de-east-1",name:"aws-eusc",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eusc\\-(de)\\-\\w+\\-\\d+$",regions:{"eusc-de-east-1":{description:"AWS European Sovereign Cloud (Germany)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"api.aws.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"aws-iso global region"},"us-iso-east-1":{description:"US ISO East"},"us-iso-west-1":{description:"US ISO WEST"}}},{id:"aws-iso-b",outputs:{dnsSuffix:"sc2s.sgov.gov",dualStackDnsSuffix:"api.aws.scloud",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"aws-iso-b global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"},"us-isob-west-1":{description:"US ISOB West"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"api.cloud-aws.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"aws-iso-e-global":{description:"aws-iso-e global region"},"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"api.aws.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{"aws-iso-f-global":{description:"aws-iso-f global region"},"us-isof-east-1":{description:"US ISOF EAST"},"us-isof-south-1":{description:"US ISOF SOUTH"}}},{id:"aws-us-gov",outputs:{dnsSuffix:"amazonaws.com",dualStackDnsSuffix:"api.aws",implicitGlobalRegion:"us-gov-west-1",name:"aws-us-gov",supportsDualStack:!0,supportsFIPS:!0},regionRegex:"^us\\-gov\\-\\w+\\-\\d+$",regions:{"aws-us-gov-global":{description:"aws-us-gov global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}}]};let qH=jH;const WH=r=>{const{partitions:e}=qH;for(const n of e){const{regions:i,outputs:a}=n;for(const[s,o]of Object.entries(i))if(s===r)return{...a,...o}}for(const n of e){const{regionRegex:i,outputs:a}=n;if(new RegExp(i).test(r))return{...a}}const t=e.find(n=>n.id==="aws");if(!t)throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist.");return{...t.outputs}},QH=/\d{12}\.ddb/;async function YH(r,e,t){if(t.request?.headers?.["smithy-protocol"]==="rpc-v2-cbor"&&Ds(r,"PROTOCOL_RPC_V2_CBOR","M"),typeof e.retryStrategy=="function"){const a=await e.retryStrategy();if(typeof a.mode=="string")switch(a.mode){case Bo.ADAPTIVE:Ds(r,"RETRY_MODE_ADAPTIVE","F");break;case Bo.STANDARD:Ds(r,"RETRY_MODE_STANDARD","E");break}}if(typeof e.accountIdEndpointMode=="function"){const a=r.endpointV2;switch(String(a?.url?.hostname).match(QH)&&Ds(r,"ACCOUNT_ID_ENDPOINT","O"),await e.accountIdEndpointMode?.()){case"disabled":Ds(r,"ACCOUNT_ID_MODE_DISABLED","Q");break;case"preferred":Ds(r,"ACCOUNT_ID_MODE_PREFERRED","P");break;case"required":Ds(r,"ACCOUNT_ID_MODE_REQUIRED","R");break}}const i=r.__smithy_context?.selectedHttpAuthScheme?.identity;if(i?.$source){const a=i;a.accountId&&Ds(r,"RESOLVED_ACCOUNT_ID","T");for(const[s,o]of Object.entries(a.$source??{}))Ds(r,s,o)}}const r2="user-agent",Yy="x-amz-user-agent",n2=" ",Xy="/",XH=/[^!$%&'*+\-.^_`|~\w]/g,JH=/[^!$%&'*+\-.^_`|~\w#]/g,i2="-",KH=1024;function ZH(r){let e="";for(const t in r){const n=r[t];if(e.length+n.length+1<=KH){e.length?e+=","+n:e+=n;continue}break}return e}const eG=r=>(e,t)=>async n=>{const{request:i}=n;if(!aa.isInstance(i))return e(n);const{headers:a}=i,s=t?.userAgent?.map(Pp)||[],o=(await r.defaultUserAgentProvider()).map(Pp);await YH(t,r,n);const l=t;o.push(`m/${ZH(Object.assign({},t.__smithy_context?.features,l.__aws_sdk_context?.features))}`);const u=r?.customUserAgent?.map(Pp)||[],c=await r.userAgentAppId();c&&o.push(Pp(["app",`${c}`]));const f=[].concat([...o,...s,...u]).join(n2),d=[...o.filter(h=>h.startsWith("aws-sdk-")),...u].join(n2);return r.runtime!=="browser"?(d&&(a[Yy]=a[Yy]?`${a[r2]} ${d}`:d),a[r2]=f):a[Yy]=f,e({...n,request:i})},Pp=r=>{const e=r[0].split(Xy).map(s=>s.replace(XH,i2)).join(Xy),t=r[1]?.replace(JH,i2),n=e.indexOf(Xy),i=e.substring(0,n);let a=e.substring(n+1);return i==="api"&&(a=a.toLowerCase()),[i,a,t].filter(s=>s&&s.length>0).reduce((s,o,l)=>{switch(l){case 0:return o;case 1:return`${s}/${o}`;default:return`${s}#${o}`}},"")},tG={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},rG=r=>({applyToStack:e=>{e.add(eG(r),tG)}}),nG=({serviceId:r,clientVersion:e})=>async t=>{const n=typeof window<"u"?window.navigator:void 0,i=n?.userAgent??"",a=n?.userAgentData?.platform??a2.os(i)??"other",s=void 0,o=n?.userAgentData?.brands??[],l=o[o.length-1],u=l?.brand??a2.browser(i)??"unknown",c=l?.version??"unknown",f=[["aws-sdk-js",e],["ua","2.1"],[`os/${a}`,s],["lang/js"],["md/browser",`${u}_${c}`]];r&&f.push([`api/${r}`,e]);const d=await t?.userAgentAppId?.();return d&&f.push([`app/${d}`]),f},a2={os(r){if(/iPhone|iPad|iPod/.test(r))return"iOS";if(/Macintosh|Mac OS X/.test(r))return"macOS";if(/Windows NT/.test(r))return"Windows";if(/Android/.test(r))return"Android";if(/Linux/.test(r))return"Linux"},browser(r){if(/EdgiOS|EdgA|Edg\//.test(r))return"Microsoft Edge";if(/Firefox\//.test(r))return"Firefox";if(/Chrome\//.test(r))return"Chrome";if(/Safari\//.test(r))return"Safari"}},IP=(r,e=!1)=>{if(e){for(const t of r.split("."))if(!IP(t))return!1;return!0}return!(!nm(r)||r.length<3||r.length>63||r!==r.toLowerCase()||mP(r))},s2=":",iG="/",aG=r=>{const e=r.split(s2);if(e.length<6)return null;const[t,n,i,a,s,...o]=e;if(t!=="arn"||n===""||i===""||o.join(s2)==="")return null;const l=o.map(u=>u.split(iG)).flat();return{partition:n,service:i,region:a,accountId:s,resourceId:l}},PP={isVirtualHostableS3Bucket:IP,parseArn:aG,partition:WH};tb.aws=PP;const sG=(r,e,t)=>{let n,i,a,s=!1;const o=async()=>{i||(i=r());try{n=await i,a=!0,s=!1}finally{i=void 0}return n};return async l=>((!a||l?.forceRefresh)&&(n=await o()),n)},o2=new Set,oG=(r,e=nm)=>{if(!o2.has(r)&&!e(r))if(r==="*")console.warn('@smithy/config-resolver WARN - Please use the caller region instead of "*". See "sigv4a" in https://github.com/aws/aws-sdk-js-v3/blob/main/supplemental-docs/CLIENTS.md.');else throw new Error(`Region not accepted: region="${r}" is not a valid hostname component.`);else o2.add(r)},DP=r=>typeof r=="string"&&(r.startsWith("fips-")||r.endsWith("-fips")),lG=r=>DP(r)?["fips-aws-global","aws-fips"].includes(r)?"us-east-1":r.replace(/fips-(dkr-|prod-)?|-fips/,""):r,uG=r=>{const{region:e,useFipsEndpoint:t}=r;if(!e)throw new Error("Region is missing");return Object.assign(r,{region:async()=>{const n=typeof e=="function"?await e():e,i=lG(n);return oG(i),i},useFipsEndpoint:async()=>{const n=typeof e=="string"?e:await e();return DP(n)?!0:typeof t!="function"?Promise.resolve(!!t):t()}})},cG=["in-region","cross-region","mobile","standard","legacy"],dG=({defaultsMode:r}={})=>sG(async()=>{const e=typeof r=="function"?await r():r;switch(e?.toLowerCase()){case"auto":return Promise.resolve(fG()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(e?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${cG.join(", ")}, got ${e}`)}}),fG=()=>{const r=window?.navigator;if(r?.connection){const{effectiveType:e,rtt:t,downlink:n}=r?.connection;if(typeof e=="string"&&e!=="4g"||Number(t)>100||Number(n)<10)return!0}return r?.userAgentData?.mobile||typeof r?.maxTouchPoints=="number"&&r?.maxTouchPoints>1},hG=!1,pG=!1,gG=r=>({setRegion(e){r.region=e},region(){return r.region}}),mG=r=>({region:r.region()}),l2=r=>oc.isInstance(r)?r.headers?.date??r.headers?.Date:void 0,RP=r=>new Date(Date.now()+r),yG=(r,e)=>Math.abs(RP(e).getTime()-r)>=3e5,u2=(r,e)=>{const t=Date.parse(r);return yG(t,e)?t-Date.now():e},sf=(r,e)=>{if(!e)throw new Error(`Property \`${r}\` is not resolved for AWS SDK SigV4Auth`);return e},vG=async r=>{const e=sf("context",r.context),t=sf("config",r.config),n=e.endpointV2?.properties?.authSchemes?.[0],a=await sf("signer",t.signer)(n),s=r?.signingRegion,o=r?.signingRegionSet,l=r?.signingName;return{config:t,signer:a,signingRegion:s,signingRegionSet:o,signingName:l}};class AG{async sign(e,t,n){if(!aa.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const i=await vG(n),{config:a,signer:s}=i;let{signingRegion:o,signingName:l}=i;const u=n.context;if(u?.authSchemes?.length??!1){const[f,d]=u.authSchemes;f?.name==="sigv4a"&&d?.name==="sigv4"&&(o=d?.signingRegion??o,l=d?.signingName??l)}return n._preRequestSystemClockOffset=a.systemClockOffset,await s.sign(e,{signingDate:RP(a.systemClockOffset),signingRegion:o,signingService:l})}errorHandler(e){return t=>{const n=t,i=n.ServerTime??l2(n.$response);if(i){const a=sf("config",e.config),s=e._preRequestSystemClockOffset,o=u2(i,a.systemClockOffset);(o!==a.systemClockOffset||s!==void 0&&s!==o)&&n.$metadata&&(a.systemClockOffset=o,n.$metadata.clockSkewCorrected=!0)}throw t}}successHandler(e,t){const n=l2(e);if(n){const i=sf("config",t.config);i.systemClockOffset=u2(n,i.systemClockOffset)}}}class bG{format(e){const t=[];for(const a of Object.keys(e)){const s=Pl(a);t.push(Uint8Array.from([s.byteLength]),s,this.formatHeaderValue(e[a]))}const n=new Uint8Array(t.reduce((a,s)=>a+s.byteLength,0));let i=0;for(const a of t)n.set(a,i),i+=a.byteLength;return n}formatHeaderValue(e){switch(e.type){case"boolean":return Uint8Array.from([e.value?0:1]);case"byte":return Uint8Array.from([2,e.value]);case"short":const t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case"integer":const n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case"long":const i=new Uint8Array(9);return i[0]=5,i.set(e.value.bytes,1),i;case"binary":const a=new DataView(new ArrayBuffer(3+e.value.byteLength));a.setUint8(0,6),a.setUint16(1,e.value.byteLength,!1);const s=new Uint8Array(a.buffer);return s.set(e.value,3),s;case"string":const o=Pl(e.value),l=new DataView(new ArrayBuffer(3+o.byteLength));l.setUint8(0,7),l.setUint16(1,o.byteLength,!1);const u=new Uint8Array(l.buffer);return u.set(o,3),u;case"timestamp":const c=new Uint8Array(9);return c[0]=8,c.set(ib.fromNumber(e.value.valueOf()).bytes,1),c;case"uuid":if(!wG.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const f=new Uint8Array(17);return f[0]=9,f.set(hP(e.value.replace(/\-/g,"")),1),f}}}var c2;(function(r){r[r.boolTrue=0]="boolTrue",r[r.boolFalse=1]="boolFalse",r[r.byte=2]="byte",r[r.short=3]="short",r[r.integer=4]="integer",r[r.long=5]="long",r[r.byteArray=6]="byteArray",r[r.string=7]="string",r[r.timestamp=8]="timestamp",r[r.uuid=9]="uuid"})(c2||(c2={}));const wG=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class ib{bytes;constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776e3||e<-9223372036854776e3)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const t=new Uint8Array(8);for(let n=7,i=Math.abs(Math.round(e));n>-1&&i>0;n--,i/=256)t[n]=i;return e<0&&d2(t),new ib(t)}valueOf(){const e=this.bytes.slice(0),t=e[0]&128;return t&&d2(e),parseInt(xo(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}function d2(r){for(let e=0;e<8;e++)r[e]^=255;for(let e=7;e>-1&&(r[e]++,r[e]===0);e--);}const xG="X-Amz-Algorithm",CG="X-Amz-Credential",OP="X-Amz-Date",SG="X-Amz-SignedHeaders",EG="X-Amz-Expires",BP="X-Amz-Signature",MP="X-Amz-Security-Token",_P="authorization",NP=OP.toLowerCase(),kG="date",TG=[_P,NP,kG],FG=BP.toLowerCase(),RA="x-amz-content-sha256",IG=MP.toLowerCase(),PG={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},DG=/^proxy-/,RG=/^sec-/,Jy="AWS4-HMAC-SHA256",OG="AWS4-HMAC-SHA256-PAYLOAD",BG="UNSIGNED-PAYLOAD",MG=50,LP="aws4_request",_G=3600*24*7,NG=({query:r={}})=>{const e=[],t={};for(const n of Object.keys(r)){if(n.toLowerCase()===FG)continue;const i=kl(n);e.push(i);const a=r[n];typeof a=="string"?t[i]=`${i}=${kl(a)}`:Array.isArray(a)&&(t[i]=a.slice(0).reduce((s,o)=>s.concat([`${i}=${kl(o)}`]),[]).sort().join("&"))}return e.sort().map(n=>t[n]).filter(n=>n).join("&")},LG=r=>UG(r).toISOString().replace(/\.\d{3}Z$/,"Z"),UG=r=>typeof r=="number"?new Date(r*1e3):typeof r=="string"?Number(r)?new Date(Number(r)*1e3):new Date(r):r;class VG{service;regionProvider;credentialProvider;sha256;uriEscapePath;applyChecksum;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:s=!0}){this.service=i,this.sha256=a,this.uriEscapePath=s,this.applyChecksum=typeof e=="boolean"?e:!0,this.regionProvider=_s(n),this.credentialProvider=_s(t)}createCanonicalRequest(e,t,n){const i=Object.keys(t).sort();return`${e.method}
|
|
3051
3054
|
${this.getCanonicalPath(e)}
|
|
3052
|
-
${
|
|
3055
|
+
${NG(e)}
|
|
3053
3056
|
${i.map(a=>`${a}:${t[a]}`).join(`
|
|
3054
3057
|
`)}
|
|
3055
3058
|
|
|
@@ -3057,9 +3060,9 @@ ${i.join(";")}
|
|
|
3057
3060
|
${n}`}async createStringToSign(e,t,n,i){const a=new this.sha256;a.update(Pf(n));const s=await a.digest();return`${i}
|
|
3058
3061
|
${e}
|
|
3059
3062
|
${t}
|
|
3060
|
-
${xo(s)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const a of e.split("/"))a?.length!==0&&a!=="."&&(a===".."?t.pop():t.push(a));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return kl(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){const t=
|
|
3061
|
-
`);return this.signString(y,{signingDate:n,signingRegion:l,signingService:s,eventStreamCredentials:o})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:i,eventStreamCredentials:a}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:i,priorSignature:e.priorSignature,eventStreamCredentials:a}).then(o=>({message:e.message,signature:o}))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:i,eventStreamCredentials:a}={}){const s=a??await this.credentialProvider();this.validateResolvedCredentials(s);const o=n??await this.regionProvider(),{shortDate:l}=this.formatDate(t),u=new this.sha256(await this.getSigningKey(s,o,l,i));return u.update(Pf(e)),xo(await u.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:i,signingRegion:a,signingService:s}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const l=a??await this.regionProvider(),u=p2(e),{longDate:c,shortDate:f}=this.formatDate(t),d=Zy(f,l,s??this.service);u.headers[NP]=c,o.sessionToken&&(u.headers[FG]=o.sessionToken);const h=await ev(u,this.sha256);!$G(RA,u.headers)&&this.applyChecksum&&(u.headers[RA]=h);const g=h2(u,i,n),y=await this.getSignature(c,d,this.getSigningKey(o,l,f,s),this.createCanonicalRequest(u,g,h));return u.headers[_P]=`${Jy} Credential=${o.accessKeyId}/${d}, SignedHeaders=${this.getCanonicalHeaderList(g)}, Signature=${y}`,u}async getSignature(e,t,n,i){const a=await this.createStringToSign(e,t,i,Jy),s=new this.sha256(await n);return s.update(Pf(a)),xo(await s.digest())}getSigningKey(e,t,n,i){return VG(this.sha256,e,n,t,i||this.service)}}const HG=r=>{let e=r.credentials,t=!!r.credentials,n;Object.defineProperty(r,"credentials",{set(u){u&&u!==e&&u!==n&&(t=!0),e=u;const c=GG(r,{credentials:e,credentialDefaultProvider:r.credentialDefaultProvider}),f=jG(r,c);if(t&&!f.attributed){const d=typeof e=="object"&&e!==null;n=async h=>{const y=await f(h);return d&&(!y.$source||Object.keys(y.$source).length===0)?ZV(y,"CREDENTIALS_CODE","e"):y},n.memoized=f.memoized,n.configBound=f.configBound,n.attributed=!0}else n=f},get(){return n},enumerable:!0,configurable:!0}),r.credentials=e;const{signingEscapePath:i=!0,systemClockOffset:a=r.systemClockOffset||0,sha256:s}=r;let o;return r.signer?o=af(r.signer):r.regionInfoProvider?o=()=>af(r.region)().then(async u=>[await r.regionInfoProvider(u,{useFipsEndpoint:await r.useFipsEndpoint(),useDualstackEndpoint:await r.useDualstackEndpoint()})||{},u]).then(([u,c])=>{const{signingRegion:f,signingService:d}=u;r.signingRegion=r.signingRegion||f||c,r.signingName=r.signingName||d||r.serviceId;const h={...r,credentials:r.credentials,region:r.signingRegion,service:r.signingName,sha256:s,uriEscapePath:i},g=r.signerConstructor||g2;return new g(h)}):o=async u=>{u=Object.assign({},{name:"sigv4",signingName:r.signingName||r.defaultSigningName,signingRegion:await af(r.region)(),properties:{}},u);const c=u.signingRegion,f=u.signingName;r.signingRegion=r.signingRegion||c,r.signingName=r.signingName||f||r.serviceId;const d={...r,credentials:r.credentials,region:r.signingRegion,service:r.signingName,sha256:s,uriEscapePath:i},h=r.signerConstructor||g2;return new h(d)},Object.assign(r,{systemClockOffset:a,signingEscapePath:i,signer:o})};function GG(r,{credentials:e,credentialDefaultProvider:t}){let n;return e?e?.memoized?n=e:n=VH(e,UH,FP):t?n=af(t(Object.assign({},r,{parentClientConfig:r}))):n=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},n.memoized=!0,n}function jG(r,e){if(e.configBound)return e;const t=async n=>e({...n,callerClientConfig:r});return t.memoized=e.memoized,t.configBound=!0,t}const qG=async(r,e,t)=>({operation:Ac(e).operation,region:await _s(r.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function WG(r){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-idp",region:r.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function Ur(r){return{schemeId:"smithy.api#noAuth"}}const QG=r=>{const e=[];switch(r.operation){case"AssociateSoftwareToken":{e.push(Ur());break}case"ChangePassword":{e.push(Ur());break}case"CompleteWebAuthnRegistration":{e.push(Ur());break}case"ConfirmDevice":{e.push(Ur());break}case"ConfirmForgotPassword":{e.push(Ur());break}case"ConfirmSignUp":{e.push(Ur());break}case"DeleteUser":{e.push(Ur());break}case"DeleteUserAttributes":{e.push(Ur());break}case"DeleteWebAuthnCredential":{e.push(Ur());break}case"ForgetDevice":{e.push(Ur());break}case"ForgotPassword":{e.push(Ur());break}case"GetDevice":{e.push(Ur());break}case"GetTokensFromRefreshToken":{e.push(Ur());break}case"GetUser":{e.push(Ur());break}case"GetUserAttributeVerificationCode":{e.push(Ur());break}case"GetUserAuthFactors":{e.push(Ur());break}case"GlobalSignOut":{e.push(Ur());break}case"InitiateAuth":{e.push(Ur());break}case"ListDevices":{e.push(Ur());break}case"ListWebAuthnCredentials":{e.push(Ur());break}case"ResendConfirmationCode":{e.push(Ur());break}case"RespondToAuthChallenge":{e.push(Ur());break}case"RevokeToken":{e.push(Ur());break}case"SetUserMFAPreference":{e.push(Ur());break}case"SetUserSettings":{e.push(Ur());break}case"SignUp":{e.push(Ur());break}case"StartWebAuthnRegistration":{e.push(Ur());break}case"UpdateAuthEventFeedback":{e.push(Ur());break}case"UpdateDeviceStatus":{e.push(Ur());break}case"UpdateUserAttributes":{e.push(Ur());break}case"VerifySoftwareToken":{e.push(Ur());break}case"VerifyUserAttribute":{e.push(Ur());break}default:e.push(WG(r))}return e},YG=r=>{const e=HG(r);return Object.assign(e,{authSchemePreference:_s(r.authSchemePreference??[])})},XG=r=>Object.assign(r,{useDualstackEndpoint:r.useDualstackEndpoint??!1,useFipsEndpoint:r.useFipsEndpoint??!1,defaultSigningName:"cognito-idp"}),UP={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},JG="3.1075.0",KG={version:JG},ZG=r=>new TextEncoder().encode(r);var ej=typeof Buffer<"u"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:ZG;function Df(r){return r instanceof Uint8Array?r:typeof r=="string"?ej(r):ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(r)}function OA(r){return typeof r=="string"?r.length===0:r.byteLength===0}var VP={name:"SHA-256"},m2={name:"HMAC",hash:VP},tj=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const rj={};function ig(){return typeof window<"u"?window:typeof self<"u"?self:rj}var nj=(function(){function r(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return r.prototype.update=function(e){if(!OA(e)){var t=Df(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},r.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return ig().crypto.subtle.sign(m2,t,e.toHash).then(function(n){return new Uint8Array(n)})}):OA(this.toHash)?Promise.resolve(tj):Promise.resolve().then(function(){return ig().crypto.subtle.digest(VP,e.toHash)}).then(function(t){return Promise.resolve(new Uint8Array(t))})},r.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(t,n){ig().crypto.subtle.importKey("raw",Df(e.secret),m2,!1,["sign"]).then(t,n)}),this.key.catch(function(){}))},r})(),ga=64,ij=32,aj=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),sj=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],oj=Math.pow(2,53)-1,ag=(function(){function r(){this.state=Int32Array.from(sj),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return r.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,this.bytesHashed*8>oj)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===ga&&(this.hashBuffer(),this.bufferLength=0)},r.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%ga>=ga-8){for(var i=this.bufferLength;i<ga;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<ga-8;i++)t.setUint8(i,0);t.setUint32(ga-8,Math.floor(e/4294967296),!0),t.setUint32(ga-4,e),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(ij),i=0;i<8;i++)a[i*4]=this.state[i]>>>24&255,a[i*4+1]=this.state[i]>>>16&255,a[i*4+2]=this.state[i]>>>8&255,a[i*4+3]=this.state[i]>>>0&255;return a},r.prototype.hashBuffer=function(){for(var e=this,t=e.buffer,n=e.state,i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=n[5],c=n[6],f=n[7],d=0;d<ga;d++){if(d<16)this.temp[d]=(t[d*4]&255)<<24|(t[d*4+1]&255)<<16|(t[d*4+2]&255)<<8|t[d*4+3]&255;else{var h=this.temp[d-2],g=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=this.temp[d-15];var y=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[d]=(g+this.temp[d-7]|0)+(y+this.temp[d-16]|0)}var v=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&u^~l&c)|0)+(f+(aj[d]+this.temp[d]|0)|0)|0,A=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&s^a&s)|0;f=c,c=u,u=l,l=o+v|0,o=s,s=a,a=i,i=v+A|0}n[0]+=i,n[1]+=a,n[2]+=s,n[3]+=o,n[4]+=l,n[5]+=u,n[6]+=c,n[7]+=f},r})(),lj=(function(){function r(e){this.secret=e,this.hash=new ag,this.reset()}return r.prototype.update=function(e){if(!(OA(e)||this.error))try{this.hash.update(Df(e))}catch(t){this.error=t}},r.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},r.prototype.digest=function(){return rs(this,void 0,void 0,function(){return ns(this,function(e){return[2,this.digestSync()]})})},r.prototype.reset=function(){if(this.hash=new ag,this.secret){this.outer=new ag;var e=uj(this.secret),t=new Uint8Array(ga);t.set(e);for(var n=0;n<ga;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(var n=0;n<e.byteLength;n++)e[n]=0}},r})();function uj(r){var e=Df(r);if(e.byteLength>ga){var t=new ag;t.update(e),e=t.digest()}var n=new Uint8Array(ga);return n.set(e),n}var cj=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function dj(r){if(fj(r)&&typeof r.crypto.subtle=="object"){var e=r.crypto.subtle;return hj(e)}return!1}function fj(r){if(typeof r=="object"&&typeof r.crypto=="object"){var e=r.crypto.getRandomValues;return typeof e=="function"}return!1}function hj(r){return r&&cj.every(function(e){return typeof r[e]=="function"})}var pj=(function(){function r(e){dj(ig())?this.hash=new nj(e):this.hash=new lj(e)}return r.prototype.update=function(e,t){this.hash.update(Df(e))},r.prototype.digest=function(){return this.hash.digest()},r.prototype.reset=function(){this.hash.reset()},r})();function y2(r,e){return new Request(r,e)}function gj(r=0){return new Promise((e,t)=>{r&&setTimeout(()=>{const n=new Error(`Request did not complete within ${r} ms`);n.name="TimeoutError",t(n)},r)})}const tv={supported:void 0};class ab{config;configProvider;static create(e){return typeof e?.handle=="function"?e:new ab(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(t=>t||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),tv.supported===void 0&&(tv.supported=typeof Request<"u"&&"keepalive"in y2("https://[::1]"))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);const i=n??this.config.requestTimeout,a=this.config.keepAlive===!0,s=this.config.credentials;if(t?.aborted){const x=v2(t);return Promise.reject(x)}let o=e.path;const l=Gz(e.query||{});l&&(o+=`?${l}`),e.fragment&&(o+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){const x=e.username??"",S=e.password??"";u=`${x}:${S}@`}const{port:c,method:f}=e,d=`${e.protocol}//${u}${e.hostname}${c?`:${c}`:""}${o}`,h=f==="GET"||f==="HEAD"?void 0:e.body,g={body:h,headers:new Headers(e.headers),method:f,credentials:s};this.config?.cache&&(g.cache=this.config.cache),h&&(g.duplex="half"),typeof AbortController<"u"&&(g.signal=t),tv.supported&&(g.keepalive=a),typeof this.config.requestInit=="function"&&Object.assign(g,this.config.requestInit(e));let y=()=>{};const v=y2(d,g),A=[fetch(v).then(x=>{const S=x.headers,F={};for(const R of S.entries())F[R[0]]=R[1];return x.body!=null?{response:new oc({headers:F,reason:x.statusText,statusCode:x.status,body:x.body})}:x.blob().then(R=>({response:new oc({headers:F,reason:x.statusText,statusCode:x.status,body:R})}))}),gj(i)];return t&&A.push(new Promise((x,S)=>{const F=()=>{const E=v2(t);S(E)};if(typeof t.addEventListener=="function"){const E=t;E.addEventListener("abort",F,{once:!0}),y=()=>E.removeEventListener("abort",F)}else t.onabort=F})),Promise.race(A).finally(y)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}}function v2(r){const e=r&&typeof r=="object"&&"reason"in r?r.reason:void 0;if(e){if(e instanceof Error){const i=new Error("Request aborted");return i.name="AbortError",i.cause=e,i}const n=new Error(String(e));return n.name="AbortError",n}const t=new Error("Request aborted");return t.name="AbortError",t}const mj=async r=>typeof Blob=="function"&&r instanceof Blob||r.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await r.arrayBuffer()):yj(r):vj(r);async function yj(r){const e=await Aj(r),t=im(e);return new Uint8Array(t)}async function vj(r){const e=[],t=r.getReader();let n=!1,i=0;for(;!n;){const{done:o,value:l}=await t.read();l&&(e.push(l),i+=l.length),n=o}const a=new Uint8Array(i);let s=0;for(const o of e)a.set(o,s),s+=o.length;return a}function Aj(r){return new Promise((e,t)=>{const n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return t(new Error("Reader aborted too early"));const i=n.result??"",a=i.indexOf(","),s=a>-1?a+1:i.length;e(i.substring(s))},n.onabort=()=>t(new Error("Read aborted")),n.onerror=()=>t(n.error),n.readAsDataURL(r)})}class bj{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){const n=t.getMemberSchemas(),i=Object.values(n).find(a=>!!a.getMergedTraits().httpPayload);if(i){const a=i.getMergedTraits().mediaType;return a||(i.isStringSchema()?"text/plain":i.isBlobSchema()?"application/octet-stream":e)}else if(!t.isUnitSchema()&&Object.values(n).find(s=>{const{httpQuery:o,httpQueryParams:l,httpHeader:u,httpLabel:c,httpPrefixHeaders:f}=s.getMergedTraits();return!o&&!l&&!u&&!c&&f===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,t,n,i,a,s){let o=e;e.includes("#")&&([,o]=e.split("#"));const l={$metadata:a,$fault:n.statusCode<500?"client":"server"};if(!this.errorRegistry)throw new Error("@aws-sdk/core/protocols - error handler not initialized.");try{return{errorSchema:s?.(this.errorRegistry,o)??this.errorRegistry.getSchema(e),errorMetadata:l}}catch{i.message=i.message??i.Message??"UnknownError";const c=this.errorRegistry,f=c.getBaseException();if(f){const g=c.getErrorCtor(f)??Error;throw this.decorateServiceException(Object.assign(new g({name:o}),l),i)}const d=i,h=d?.message??d?.Message??d?.Error?.Message??d?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(h),{name:o},l),i)}}compose(e,t,n){let i=n;t.includes("#")&&([i]=t.split("#"));const a=ta.for(i),s=ta.for("smithy.ts.sdk.synthetic."+n);e.copyFrom(a),e.copyFrom(s),this.errorRegistry=e}decorateServiceException(e,t={}){if(this.queryCompat){const n=e.Message??t.Message,i=qE(e,t);n&&(i.message=n);const a=i.Error??{};a.Type=i.Error?.Type,a.Code=i.Error?.Code,a.Message=i.Error?.message??i.Error?.Message??n,i.Error=a;const s=i.$metadata.requestId;return s&&(i.RequestId=s),i}return qE(e,t)}setQueryCompatError(e,t){const n=t.headers?.["x-amzn-query-error"];if(e!==void 0&&n!=null){const[i,a]=n.split(";"),s=Object.keys(e),o={Code:i,Type:a};e.Code=i,e.Type=a;for(let l=0;l<s.length;l++){const u=s[l];o[u==="message"?"Message":u]=e[u]}delete o.__type,e.Error=o}}queryCompatOutput(e,t){e.Error&&(t.Error=e.Error),e.Type&&(t.Type=e.Type),e.Code&&(t.Code=e.Code)}findQueryCompatibleError(e,t){try{return e.getSchema(t)}catch{return e.find(i=>yi.of(i).getMergedTraits().awsQueryError?.[0]===t)}}}class sb{serdeContext;setSerdeContext(e){this.serdeContext=e}}class wj{from;to;keys;constructor(e,t){this.from=e,this.to=t;const n=Object.keys(this.from),i=new Set(n);i.delete("__type"),this.keys=i}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){const e=this.keys.values().next().value,t=this.from[e];this.to.$unknown=[e,t]}}}function xj(r,e,t){if(t?.source){const n=t.source;if(typeof e=="number"&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER||n!==String(e)))return n.includes(".")?new as(n,"bigDecimal"):BigInt(n)}return e}const Cj=(r,e)=>PA(r,e).then(t=>(e?.utf8Encoder??am)(t)),Sj=(r,e)=>Cj(r,e).then(t=>{if(t.length)try{return JSON.parse(t)}catch(n){throw n?.name==="SyntaxError"&&Object.defineProperty(n,"$responseBodyText",{value:t}),n}return{}}),A2=(r,e)=>Object.keys(r).find(t=>t.toLowerCase()===e.toLowerCase()),rv=r=>{let e=r;return typeof e=="number"&&(e=e.toString()),e.indexOf(",")>=0&&(e=e.split(",")[0]),e.indexOf(":")>=0&&(e=e.split(":")[0]),e.indexOf("#")>=0&&(e=e.split("#")[1]),e},Ej=(r,e,t=!1)=>kj(r,e,t?["code","header","type"]:["type","code","header"]),kj=({headers:r},e,t)=>{for(;t.length>0;)switch(t.shift()){case"header":const i=A2(r??{},"x-amzn-errortype");if(i!==void 0)return rv(r[i]);break;case"code":const a=A2(e??{},"code");if(a&&e[a]!==void 0)return rv(e[a]);break;case"type":if(e?.__type!==void 0)return rv(e.__type);break}};class Tj extends sb{settings;constructor(e){super(),this.settings=e}async read(e,t){return this._read(e,typeof t=="string"?JSON.parse(t,xj):await Sj(t,this.serdeContext))}readObject(e,t){return this._read(e,t)}_read(e,t){const n=t!==null&&typeof t=="object",i=yi.of(e);if(n){if(i.isStructSchema()){const s=t,o=i.isUnionSchema(),l={};let u;const{jsonName:c}=this.settings;c&&(u={});let f;o&&(f=new wj(s,l));for(const[d,h]of i.structIterator()){let g=d;c&&(g=h.getMergedTraits().jsonName??g,u[g]=d),o&&f.mark(g),s[g]!=null&&(l[d]=this._read(h,s[g]))}if(o)f.writeUnknown();else if(typeof s.__type=="string")for(const d in s){const h=s[d],g=c?u[d]??d:d;g in l||(l[g]=h)}return l}if(Array.isArray(t)&&i.isListSchema()){const s=i.getValueSchema(),o=[];for(const l of t)o.push(this._read(s,l));return o}if(i.isMapSchema()){const s=i.getValueSchema(),o={};for(const l in t)o[l]=this._read(s,t[l]);return o}}if(i.isBlobSchema()&&typeof t=="string")return im(t);const a=i.getMergedTraits().mediaType;if(i.isStringSchema()&&typeof t=="string"&&a)return a==="application/json"||a.endsWith("+json")?yo.from(t):t;if(i.isTimestampSchema()&&t!=null)switch(EP(i,this.settings)){case 5:return _$(t);case 6:return dP(t);case 7:return V$(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(i.isBigIntegerSchema()&&(typeof t=="number"||typeof t=="string"))return BigInt(t);if(i.isBigDecimalSchema()&&t!=null){if(t instanceof as)return t;const s=t;return s.type==="bigDecimal"&&"string"in s?new as(s.string,s.type):new as(String(t),"bigDecimal")}if(i.isNumericSchema()&&typeof t=="string"){switch(t){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return t}if(i.isDocumentSchema())if(n){const s=Array.isArray(t)?[]:{};for(const o in t){const l=t[o];l instanceof as?s[o]=l:s[o]=this._read(i,l)}return s}else return structuredClone(t);return t}}const b2="Ν";class Fj{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,t)=>{if(t instanceof as){const n=`${b2+"nv"+this.counter++}_`+t.string;return this.values.set(`"${n}"`,t.string),n}if(typeof t=="bigint"){const n=t.toString(),i=`${b2+"b"+this.counter++}_`+n;return this.values.set(`"${i}"`,n),i}return t}}replaceInJson(e){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(const[t,n]of this.values)e=e.replace(t,n);return e}}class Ij extends sb{settings;buffer;useReplacer=!1;rootSchema;constructor(e){super(),this.settings=e}write(e,t){this.rootSchema=yi.of(e),this.buffer=this._write(this.rootSchema,t)}flush(){const{rootSchema:e,useReplacer:t}=this;if(this.rootSchema=void 0,this.useReplacer=!1,e?.isStructSchema()||e?.isDocumentSchema()){if(!t)return JSON.stringify(this.buffer);const n=new Fj;return n.replaceInJson(JSON.stringify(this.buffer,n.createReplacer(),0))}return this.buffer}writeDiscriminatedDocument(e,t){this.write(e,t),typeof this.buffer=="object"&&(this.buffer.__type=yi.of(e).getName(!0))}_write(e,t,n){const i=t!==null&&typeof t=="object",a=yi.of(e);if(i){if(a.isStructSchema()){const s=t,o={},{jsonName:l}=this.settings;let u;l&&(u={});let c=0;for(const[f,d]of a.structIterator()){const h=this._write(d,s[f],a);if(h!==void 0){let g=f;l&&(g=d.getMergedTraits().jsonName??f,u[f]=g),o[g]=h,c++}}if(a.isUnionSchema()&&c===0){const{$unknown:f}=s;if(Array.isArray(f)){const[d,h]=f;o[d]=this._write(15,h)}}else if(typeof s.__type=="string")for(const f in s){const d=s[f],h=l?u[f]??f:f;h in o||(o[h]=this._write(15,d))}return o}if(Array.isArray(t)&&a.isListSchema()){const s=a.getValueSchema(),o=[],l=!!a.getMergedTraits().sparse;for(const u of t)(l||u!=null)&&o.push(this._write(s,u));return o}if(a.isMapSchema()){const s=a.getValueSchema(),o={},l=!!a.getMergedTraits().sparse;for(const u in t){const c=t[u];(l||c!=null)&&(o[u]=this._write(s,c))}return o}if(t instanceof Uint8Array&&(a.isBlobSchema()||a.isDocumentSchema()))return a===this.rootSchema?t:(this.serdeContext?.base64Encoder??Tg)(t);if(t instanceof Date&&(a.isTimestampSchema()||a.isDocumentSchema()))switch(EP(a,this.settings)){case 5:return t.toISOString().replace(".000Z","Z");case 6:return B$(t);case 7:return t.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",t),t.getTime()/1e3}t instanceof as&&(this.useReplacer=!0)}if(!(t===null&&n?.isStructSchema())){if(a.isStringSchema()){if(typeof t>"u"&&a.isIdempotencyToken())return Bz();const s=a.getMergedTraits().mediaType;return t!=null&&s&&(s==="application/json"||s.endsWith("+json"))?yo.from(t):t}if(typeof t=="number"&&a.isNumericSchema())return Math.abs(t)===1/0||isNaN(t)?String(t):t;if(typeof t=="string"&&a.isBlobSchema())return a===this.rootSchema?t:(this.serdeContext?.base64Encoder??Tg)(t);if(typeof t=="bigint"&&(this.useReplacer=!0),a.isDocumentSchema())if(i){const s=Array.isArray(t)?[]:{};for(const o in t){const l=t[o];l instanceof as?(this.useReplacer=!0,s[o]=l):s[o]=this._write(a,l)}return s}else return structuredClone(t);return t}}}class Pj extends sb{settings;constructor(e){super(),this.settings=e}createSerializer(){const e=new Ij(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){const e=new Tj(this.settings);return e.setSerdeContext(this.serdeContext),e}}class Dj extends Nz{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a}){super({defaultNamespace:e,errorTypeRegistries:t}),this.serviceTarget=n,this.codec=a??new Pj({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!i,this.mixin=new bj(this.awsQueryCompatible)}async serializeRequest(e,t,n){const i=await super.serializeRequest(e,t,n);return i.path.endsWith("/")||(i.path+="/"),i.headers["content-type"]=`application/x-amz-json-${this.getJsonRpcVersion()}`,i.headers["x-amz-target"]=`${this.serviceTarget}.${e.name}`,this.awsQueryCompatible&&(i.headers["x-amzn-query-mode"]="true"),(tg(e.input)==="unit"||!i.body)&&(i.body="{}"),i}getPayloadCodec(){return this.codec}async handleError(e,t,n,i,a){const{awsQueryCompatible:s}=this;s&&this.mixin.setQueryCompatError(i,n);const o=Ej(n,i,s)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,o,this.options.defaultNamespace);const{errorSchema:l,errorMetadata:u}=await this.mixin.getErrorSchemaOrThrowBaseException(o,this.options.defaultNamespace,n,i,a,s?this.mixin.findQueryCompatibleError:void 0),c=yi.of(l),f=i.message??i.Message??"UnknownError",d=this.compositeErrorRegistry.getErrorCtor(l)??Error,h=new d({}),g={},y=this.codec.createDeserializer();for(const[v,A]of c.structIterator())i[v]!=null&&(g[v]=y.readObject(A,i[v]));throw s&&this.mixin.queryCompatOutput(i,g),this.mixin.decorateServiceException(Object.assign(h,u,{$fault:c.getMergedTraits().error,message:f},g),i)}}class Rj extends Dj{constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a}){super({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}const Rf="ref",yl=-1,Rp=!0,w2="isSet",$P="PartitionResult",Op="booleanEquals",nv="getAttr",Pd="stringEquals",x2={[Rf]:"Endpoint"},iv={[Rf]:$P},qd={[Rf]:"Region"},Ja={},C2=[qd],S2={conditions:[[w2,[x2]],[w2,C2],["aws.partition",C2,$P],[Op,[{[Rf]:"UseFIPS"},Rp]],[Op,[{fn:nv,argv:[iv,"supportsFIPS"]},Rp]],[Op,[{[Rf]:"UseDualStack"},Rp]],[Op,[{fn:nv,argv:[iv,"supportsDualStack"]},Rp]],[Pd,[{fn:nv,argv:[iv,"name"]},"aws"]],[Pd,[qd,"us-east-1"]],[Pd,[qd,"us-east-2"]],[Pd,[qd,"us-west-1"]],[Pd,[qd,"us-west-2"]]],results:[[yl],[yl,"Invalid Configuration: FIPS and custom endpoint are not supported"],[yl,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[x2,Ja],["https://cognito-idp-fips.us-east-1.amazonaws.com",Ja],["https://cognito-idp-fips.us-east-2.amazonaws.com",Ja],["https://cognito-idp-fips.us-west-1.amazonaws.com",Ja],["https://cognito-idp-fips.us-west-2.amazonaws.com",Ja],["https://cognito-idp-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Ja],[yl,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://cognito-idp-fips.{Region}.{PartitionResult#dnsSuffix}",Ja],[yl,"FIPS is enabled but this partition does not support FIPS"],["https://cognito-idp.{Region}.amazonaws.com",Ja],["https://cognito-idp.{Region}.{PartitionResult#dualStackDnsSuffix}",Ja],[yl,"DualStack is enabled but this partition does not support DualStack"],["https://cognito-idp.{Region}.{PartitionResult#dnsSuffix}",Ja],[yl,"Invalid Configuration: Missing Region"]]},Oj=2,pi=1e8,Bj=new Int32Array([-1,1,-1,0,17,3,1,4,pi+16,2,5,pi+16,3,9,6,5,7,pi+15,6,8,pi+14,7,pi+12,pi+13,4,11,10,5,pi+9,pi+11,5,12,pi+10,6,13,pi+9,8,pi+4,14,9,pi+5,15,10,pi+6,16,11,pi+7,pi+8,3,pi+1,18,5,pi+2,pi+3]),Mj=eb.from(Bj,Oj,S2.conditions,S2.results),_j=new fz({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Nj=(r,e={})=>_j.get(r,()=>Dz(Mj,{endpointParams:r,logger:e.logger}));tb.aws=PP;class xt extends $u{constructor(e){super(e),Object.setPrototypeOf(this,xt.prototype)}}class ob extends xt{name="AccessDeniedException";$fault="client";constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,ob.prototype)}}class lb extends xt{name="InternalErrorException";$fault="server";constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),Object.setPrototypeOf(this,lb.prototype)}}class ub extends xt{name="InvalidParameterException";$fault="client";reasonCode;constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),Object.setPrototypeOf(this,ub.prototype),this.reasonCode=e.reasonCode}}class cb extends xt{name="NotAuthorizedException";$fault="client";constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,cb.prototype)}}class db extends xt{name="OperationNotEnabledException";$fault="client";constructor(e){super({name:"OperationNotEnabledException",$fault:"client",...e}),Object.setPrototypeOf(this,db.prototype)}}class fb extends xt{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,fb.prototype)}}class hb extends xt{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),Object.setPrototypeOf(this,hb.prototype)}}class pb extends xt{name="UserImportInProgressException";$fault="client";constructor(e){super({name:"UserImportInProgressException",$fault:"client",...e}),Object.setPrototypeOf(this,pb.prototype)}}class gb extends xt{name="InternalServerException";$fault="server";constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,gb.prototype)}}class mb extends xt{name="LimitExceededException";$fault="client";constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,mb.prototype)}}class yb extends xt{name="UserNotFoundException";$fault="client";constructor(e){super({name:"UserNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,yb.prototype)}}class vb extends xt{name="InvalidLambdaResponseException";$fault="client";constructor(e){super({name:"InvalidLambdaResponseException",$fault:"client",...e}),Object.setPrototypeOf(this,vb.prototype)}}class Ab extends xt{name="TooManyFailedAttemptsException";$fault="client";constructor(e){super({name:"TooManyFailedAttemptsException",$fault:"client",...e}),Object.setPrototypeOf(this,Ab.prototype)}}class bb extends xt{name="UnexpectedLambdaException";$fault="client";constructor(e){super({name:"UnexpectedLambdaException",$fault:"client",...e}),Object.setPrototypeOf(this,bb.prototype)}}class wb extends xt{name="UserLambdaValidationException";$fault="client";constructor(e){super({name:"UserLambdaValidationException",$fault:"client",...e}),Object.setPrototypeOf(this,wb.prototype)}}class xb extends xt{name="CodeDeliveryFailureException";$fault="client";constructor(e){super({name:"CodeDeliveryFailureException",$fault:"client",...e}),Object.setPrototypeOf(this,xb.prototype)}}class Cb extends xt{name="InvalidPasswordException";$fault="client";constructor(e){super({name:"InvalidPasswordException",$fault:"client",...e}),Object.setPrototypeOf(this,Cb.prototype)}}class Sb extends xt{name="InvalidSmsRoleAccessPolicyException";$fault="client";constructor(e){super({name:"InvalidSmsRoleAccessPolicyException",$fault:"client",...e}),Object.setPrototypeOf(this,Sb.prototype)}}class Eb extends xt{name="InvalidSmsRoleTrustRelationshipException";$fault="client";constructor(e){super({name:"InvalidSmsRoleTrustRelationshipException",$fault:"client",...e}),Object.setPrototypeOf(this,Eb.prototype)}}class kb extends xt{name="PreconditionNotMetException";$fault="client";constructor(e){super({name:"PreconditionNotMetException",$fault:"client",...e}),Object.setPrototypeOf(this,kb.prototype)}}class Tb extends xt{name="UnsupportedUserStateException";$fault="client";constructor(e){super({name:"UnsupportedUserStateException",$fault:"client",...e}),Object.setPrototypeOf(this,Tb.prototype)}}class Fb extends xt{name="UsernameExistsException";$fault="client";constructor(e){super({name:"UsernameExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Fb.prototype)}}class Ib extends xt{name="AliasExistsException";$fault="client";constructor(e){super({name:"AliasExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Ib.prototype)}}class Pb extends xt{name="InvalidUserPoolConfigurationException";$fault="client";constructor(e){super({name:"InvalidUserPoolConfigurationException",$fault:"client",...e}),Object.setPrototypeOf(this,Pb.prototype)}}class Db extends xt{name="InvalidEmailRoleAccessPolicyException";$fault="client";constructor(e){super({name:"InvalidEmailRoleAccessPolicyException",$fault:"client",...e}),Object.setPrototypeOf(this,Db.prototype)}}class Rb extends xt{name="MFAMethodNotFoundException";$fault="client";constructor(e){super({name:"MFAMethodNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,Rb.prototype)}}class Ob extends xt{name="PasswordResetRequiredException";$fault="client";constructor(e){super({name:"PasswordResetRequiredException",$fault:"client",...e}),Object.setPrototypeOf(this,Ob.prototype)}}class Bb extends xt{name="UnsupportedOperationException";$fault="client";constructor(e){super({name:"UnsupportedOperationException",$fault:"client",...e}),Object.setPrototypeOf(this,Bb.prototype)}}class Mb extends xt{name="UserNotConfirmedException";$fault="client";constructor(e){super({name:"UserNotConfirmedException",$fault:"client",...e}),Object.setPrototypeOf(this,Mb.prototype)}}class _b extends xt{name="UserPoolAddOnNotEnabledException";$fault="client";constructor(e){super({name:"UserPoolAddOnNotEnabledException",$fault:"client",...e}),Object.setPrototypeOf(this,_b.prototype)}}class Nb extends xt{name="CodeMismatchException";$fault="client";constructor(e){super({name:"CodeMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,Nb.prototype)}}class Lb extends xt{name="ExpiredCodeException";$fault="client";constructor(e){super({name:"ExpiredCodeException",$fault:"client",...e}),Object.setPrototypeOf(this,Lb.prototype)}}class Ub extends xt{name="PasswordHistoryPolicyViolationException";$fault="client";constructor(e){super({name:"PasswordHistoryPolicyViolationException",$fault:"client",...e}),Object.setPrototypeOf(this,Ub.prototype)}}class Vb extends xt{name="SoftwareTokenMFANotFoundException";$fault="client";constructor(e){super({name:"SoftwareTokenMFANotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,Vb.prototype)}}class $b extends xt{name="ConcurrentModificationException";$fault="client";constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),Object.setPrototypeOf(this,$b.prototype)}}class zb extends xt{name="ForbiddenException";$fault="client";constructor(e){super({name:"ForbiddenException",$fault:"client",...e}),Object.setPrototypeOf(this,zb.prototype)}}class Hb extends xt{name="WebAuthnChallengeNotFoundException";$fault="client";constructor(e){super({name:"WebAuthnChallengeNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,Hb.prototype)}}class Gb extends xt{name="WebAuthnClientMismatchException";$fault="client";constructor(e){super({name:"WebAuthnClientMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,Gb.prototype)}}class jb extends xt{name="WebAuthnCredentialNotSupportedException";$fault="client";constructor(e){super({name:"WebAuthnCredentialNotSupportedException",$fault:"client",...e}),Object.setPrototypeOf(this,jb.prototype)}}class qb extends xt{name="WebAuthnNotEnabledException";$fault="client";constructor(e){super({name:"WebAuthnNotEnabledException",$fault:"client",...e}),Object.setPrototypeOf(this,qb.prototype)}}class Wb extends xt{name="WebAuthnOriginNotAllowedException";$fault="client";constructor(e){super({name:"WebAuthnOriginNotAllowedException",$fault:"client",...e}),Object.setPrototypeOf(this,Wb.prototype)}}class Qb extends xt{name="WebAuthnRelyingPartyMismatchException";$fault="client";constructor(e){super({name:"WebAuthnRelyingPartyMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,Qb.prototype)}}class Yb extends xt{name="DeviceKeyExistsException";$fault="client";constructor(e){super({name:"DeviceKeyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Yb.prototype)}}class Xb extends xt{name="GroupExistsException";$fault="client";constructor(e){super({name:"GroupExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Xb.prototype)}}class Jb extends xt{name="DuplicateProviderException";$fault="client";constructor(e){super({name:"DuplicateProviderException",$fault:"client",...e}),Object.setPrototypeOf(this,Jb.prototype)}}class Kb extends xt{name="ManagedLoginBrandingExistsException";$fault="client";constructor(e){super({name:"ManagedLoginBrandingExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Kb.prototype)}}class Zb extends xt{name="TermsExistsException";$fault="client";constructor(e){super({name:"TermsExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Zb.prototype)}}class ew extends xt{name="FeatureUnavailableInTierException";$fault="client";constructor(e){super({name:"FeatureUnavailableInTierException",$fault:"client",...e}),Object.setPrototypeOf(this,ew.prototype)}}class tw extends xt{name="TierChangeNotAllowedException";$fault="client";constructor(e){super({name:"TierChangeNotAllowedException",$fault:"client",...e}),Object.setPrototypeOf(this,tw.prototype)}}class rw extends xt{name="UserPoolTaggingException";$fault="client";constructor(e){super({name:"UserPoolTaggingException",$fault:"client",...e}),Object.setPrototypeOf(this,rw.prototype)}}class nw extends xt{name="InvalidOAuthFlowException";$fault="client";constructor(e){super({name:"InvalidOAuthFlowException",$fault:"client",...e}),Object.setPrototypeOf(this,nw.prototype)}}class iw extends xt{name="ScopeDoesNotExistException";$fault="client";constructor(e){super({name:"ScopeDoesNotExistException",$fault:"client",...e}),Object.setPrototypeOf(this,iw.prototype)}}class aw extends xt{name="UnsupportedIdentityProviderException";$fault="client";constructor(e){super({name:"UnsupportedIdentityProviderException",$fault:"client",...e}),Object.setPrototypeOf(this,aw.prototype)}}class sw extends xt{name="RefreshTokenReuseException";$fault="client";constructor(e){super({name:"RefreshTokenReuseException",$fault:"client",...e}),Object.setPrototypeOf(this,sw.prototype)}}class ow extends xt{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,ow.prototype)}}class lw extends xt{name="UnsupportedTokenTypeException";$fault="client";constructor(e){super({name:"UnsupportedTokenTypeException",$fault:"client",...e}),Object.setPrototypeOf(this,lw.prototype)}}class uw extends xt{name="WebAuthnConfigurationMissingException";$fault="client";constructor(e){super({name:"WebAuthnConfigurationMissingException",$fault:"client",...e}),Object.setPrototypeOf(this,uw.prototype)}}class cw extends xt{name="EnableSoftwareTokenMFAException";$fault="client";constructor(e){super({name:"EnableSoftwareTokenMFAException",$fault:"client",...e}),Object.setPrototypeOf(this,cw.prototype)}}const Lj="AvailableChallenges",Uj="AccessDeniedException",Vj="AliasExistsException",$j="AnalyticsEndpointId",zj="AuthFlow",zP="AnalyticsMetadata",Hj="AnalyticsMetadataType",Gj="AuthParameters",jj="AuthParametersType",HP="AuthenticationResult",qj="AuthenticationResultType",Wj="AccessToken",Qj="CodeDeliveryFailureException",GP="ClientId",Yj="ClientIdType",jP="ClientMetadata",Xj="CodeMismatchException",Jj="ConcurrentModificationException",dw="ChallengeName",qP="ChallengeParameters",Kj="ChallengeResponses",Zj="ChallengeResponsesType",eq="DeviceGroupKey",tq="DeviceKey",rq="DeviceKeyExistsException",nq="DuplicateProviderException",iq="ExpiredCodeException",aq="EncodedData",sq="ExpiresIn",oq="EnableSoftwareTokenMFAException",lq="ForbiddenException",uq="FeatureUnavailableInTierException",cq="GroupExistsException",dq="IpAddress",fq="InitiateAuthRequest",hq="InitiateAuthResponse",pq="InitiateAuth",gq="InternalErrorException",mq="InvalidEmailRoleAccessPolicyException",yq="InvalidLambdaResponseException",vq="InvalidOAuthFlowException",Aq="InvalidParameterException",bq="InvalidPasswordException",wq="InternalServerException",xq="InvalidSmsRoleAccessPolicyException",Cq="InvalidSmsRoleTrustRelationshipException",Sq="IdToken",Eq="InvalidUserPoolConfigurationException",kq="LimitExceededException",Tq="MFAMethodNotFoundException",Fq="ManagedLoginBrandingExistsException",Iq="NotAuthorizedException",Pq="NewDeviceMetadata",Dq="NewDeviceMetadataType",Rq="OperationNotEnabledException",Oq="PasswordHistoryPolicyViolationException",Bq="PreconditionNotMetException",Mq="PasswordResetRequiredException",_q="ResourceNotFoundException",Nq="RefreshToken",Lq="RespondToAuthChallenge",Uq="RespondToAuthChallengeRequest",Vq="RespondToAuthChallengeResponse",$q="RefreshTokenReuseException",lm="Session",zq="ScopeDoesNotExistException",Hq="SessionType",Gq="SoftwareTokenMFANotFoundException",jq="TierChangeNotAllowedException",qq="TermsExistsException",Wq="TooManyFailedAttemptsException",Qq="TooManyRequestsException",Yq="TokenModelType",Xq="TokenType",Jq="UserContextDataType",WP="UserContextData",Kq="UnauthorizedException",Zq="UsernameExistsException",eW="UserImportInProgressException",tW="UnsupportedIdentityProviderException",rW="UnexpectedLambdaException",nW="UserLambdaValidationException",iW="UserNotConfirmedException",aW="UserNotFoundException",sW="UnsupportedOperationException",oW="UserPoolAddOnNotEnabledException",lW="UserPoolTaggingException",uW="UnsupportedTokenTypeException",cW="UnsupportedUserStateException",dW="WebAuthnClientMismatchException",fW="WebAuthnConfigurationMissingException",hW="WebAuthnChallengeNotFoundException",pW="WebAuthnCredentialNotSupportedException",gW="WebAuthnNotEnabledException",mW="WebAuthnOriginNotAllowedException",yW="WebAuthnRelyingPartyMismatchException",It="client",Tt="error",Pt="httpError",Ft="message",vW="reasonCode",QP="smithy.ts.sdk.synthetic.com.amazonaws.cognitoidentityprovider",YP="server",at="com.amazonaws.cognitoidentityprovider",XP=ta.for(QP);var AW=[-3,QP,"CognitoIdentityProviderServiceException",0,[],[]];XP.registerError(AW,xt);const kt=ta.for(at);var bW=[-3,at,Uj,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(bW,ob);var wW=[-3,at,Vj,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(wW,Ib);var xW=[-3,at,Qj,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(xW,xb);var CW=[-3,at,Xj,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(CW,Nb);var SW=[-3,at,Jj,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(SW,$b);var EW=[-3,at,rq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(EW,Yb);var kW=[-3,at,nq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(kW,Jb);var TW=[-3,at,oq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(TW,cw);var FW=[-3,at,iq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(FW,Lb);var IW=[-3,at,uq,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(IW,ew);var PW=[-3,at,lq,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(PW,zb);var DW=[-3,at,cq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(DW,Xb);var RW=[-3,at,gq,{[Tt]:YP},[Ft],[0]];kt.registerError(RW,lb);var OW=[-3,at,wq,{[Tt]:YP},[Ft],[0]];kt.registerError(OW,gb);var BW=[-3,at,mq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(BW,Db);var MW=[-3,at,yq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(MW,vb);var _W=[-3,at,vq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(_W,nw);var NW=[-3,at,Aq,{[Tt]:It,[Pt]:400},[Ft,vW],[0,0]];kt.registerError(NW,ub);var LW=[-3,at,bq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(LW,Cb);var UW=[-3,at,xq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(UW,Sb);var VW=[-3,at,Cq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(VW,Eb);var $W=[-3,at,Eq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError($W,Pb);var zW=[-3,at,kq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(zW,mb);var HW=[-3,at,Fq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(HW,Kb);var GW=[-3,at,Tq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(GW,Rb);var jW=[-3,at,Iq,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(jW,cb);var qW=[-3,at,Rq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(qW,db);var WW=[-3,at,Oq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(WW,Ub);var QW=[-3,at,Mq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(QW,Ob);var YW=[-3,at,Bq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(YW,kb);var XW=[-3,at,$q,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(XW,sw);var JW=[-3,at,_q,{[Tt]:It,[Pt]:404},[Ft],[0]];kt.registerError(JW,fb);var KW=[-3,at,zq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(KW,iw);var ZW=[-3,at,Gq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(ZW,Vb);var eQ=[-3,at,qq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(eQ,Zb);var tQ=[-3,at,jq,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(tQ,tw);var rQ=[-3,at,Wq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(rQ,Ab);var nQ=[-3,at,Qq,{[Tt]:It,[Pt]:429},[Ft],[0]];kt.registerError(nQ,hb);var iQ=[-3,at,Kq,{[Tt]:It,[Pt]:401},[Ft],[0]];kt.registerError(iQ,ow);var aQ=[-3,at,rW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(aQ,bb);var sQ=[-3,at,tW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(sQ,aw);var oQ=[-3,at,sW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(oQ,Bb);var lQ=[-3,at,uW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(lQ,lw);var uQ=[-3,at,cW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(uQ,Tb);var cQ=[-3,at,eW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(cQ,pb);var dQ=[-3,at,nW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(dQ,wb);var fQ=[-3,at,Zq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(fQ,Fb);var hQ=[-3,at,iW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(hQ,Mb);var pQ=[-3,at,aW,{[Tt]:It,[Pt]:404},[Ft],[0]];kt.registerError(pQ,yb);var gQ=[-3,at,oW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(gQ,_b);var mQ=[-3,at,lW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(mQ,rw);var yQ=[-3,at,hW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(yQ,Hb);var vQ=[-3,at,dW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(vQ,Gb);var AQ=[-3,at,fW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(AQ,uw);var bQ=[-3,at,pW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(bQ,jb);var wQ=[-3,at,gW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(wQ,qb);var xQ=[-3,at,mW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(xQ,Wb);var CQ=[-3,at,yW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(CQ,Qb);const SQ=[XP,kt];var JP=[0,at,Yj,8,0],um=[0,at,Hq,8,0],av=[0,at,Yq,8,0],KP=[3,at,Hj,0,[$j],[0]],ZP=[3,at,qj,0,[Wj,sq,Xq,Nq,Sq,Pq],[[()=>av,0],1,0,[()=>av,0],[()=>av,0],()=>TQ]],EQ=[3,at,fq,0,[zj,GP,Gj,jP,zP,WP,lm],[0,[()=>JP,0],[()=>PQ,0],128,()=>KP,[()=>eD,0],[()=>um,0]],2],kQ=[3,at,hq,0,[dw,lm,qP,HP,Lj],[0,[()=>um,0],128,[()=>ZP,0],64]],TQ=[3,at,Dq,0,[tq,eq],[0,0]],FQ=[3,at,Uq,0,[GP,dw,lm,Kj,zP,WP,jP],[[()=>JP,0],0,[()=>um,0],[()=>DQ,0],()=>KP,[()=>eD,0],128],2],IQ=[3,at,Vq,0,[dw,lm,qP,HP],[0,[()=>um,0],128,[()=>ZP,0]]],eD=[3,at,Jq,8,[dq,aq],[0,0]],PQ=[2,at,jj,8,0,0],DQ=[2,at,Zj,8,0,0],RQ=[9,at,pq,0,()=>EQ,()=>kQ],OQ=[9,at,Lq,0,()=>FQ,()=>IQ];const BQ=r=>({apiVersion:"2016-04-18",base64Decoder:r?.base64Decoder??im,base64Encoder:r?.base64Encoder??Tg,disableHostPrefix:r?.disableHostPrefix??!1,endpointProvider:r?.endpointProvider??Nj,extensions:r?.extensions??[],httpAuthSchemeProvider:r?.httpAuthSchemeProvider??QG,httpAuthSchemes:r?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new vG},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new _H}],logger:r?.logger??new lP,protocol:r?.protocol??Rj,protocolSettings:r?.protocolSettings??{defaultNamespace:"com.amazonaws.cognitoidentityprovider",errorTypeRegistries:SQ,xmlNamespace:"http://cognito-idp.amazonaws.com/doc/2016-04-18/",version:"2016-04-18",serviceTarget:"AWSCognitoIdentityProviderService"},serviceId:r?.serviceId??"Cognito Identity Provider",urlParser:r?.urlParser??kg,utf8Decoder:r?.utf8Decoder??Pl,utf8Encoder:r?.utf8Encoder??am}),MQ=r=>{const e=cG(r),t=()=>e().then(h$),n=BQ(r);return{...n,...r,runtime:"browser",defaultsMode:e,bodyLengthChecker:r?.bodyLengthChecker??Y$,credentialDefaultProvider:r?.credentialDefaultProvider??(i=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:r?.defaultUserAgentProvider??rG({serviceId:n.serviceId,clientVersion:KG.version}),maxAttempts:r?.maxAttempts??nf,region:r?.region??i$("Region is missing"),requestHandler:ab.create(r?.requestHandler??t),retryMode:r?.retryMode??(async()=>(await t()).retryMode||pH),sha256:r?.sha256??pj,streamCollector:r?.streamCollector??mj,useDualstackEndpoint:r?.useDualstackEndpoint??(()=>Promise.resolve(fG)),useFipsEndpoint:r?.useFipsEndpoint??(()=>Promise.resolve(hG))}},_Q=r=>{const e=r.httpAuthSchemes;let t=r.httpAuthSchemeProvider,n=r.credentials;return{setHttpAuthScheme(i){const a=e.findIndex(s=>s.schemeId===i.schemeId);a===-1?e.push(i):e.splice(a,1,i)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(i){t=i},httpAuthSchemeProvider(){return t},setCredentials(i){n=i},credentials(){return n}}},NQ=r=>({httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()}),LQ=(r,e)=>{const t=Object.assign(pG(r),v$(r),Lz(r),_Q(r));return e.forEach(n=>n.configure(t)),Object.assign(r,gG(t),A$(t),Uz(t),NQ(t))};class UQ extends a${config;constructor(...[e]){const t=MQ(e||{});super(t),this.initConfig=t;const n=XG(t),i=HH(n),a=mH(i),s=lG(a),o=s,l=Rz(o),u=YG(l),c=LQ(u,e?.extensions||[]);this.config=c,this.middlewareStack.use(c$(this.config)),this.middlewareStack.use(tG(this.config)),this.middlewareStack.use(yH(this.config)),this.middlewareStack.use(zz(this.config)),this.middlewareStack.use(bH(this.config)),this.middlewareStack.use(CH(this.config)),this.middlewareStack.use(SH(this.config)),this.middlewareStack.use(IH(this.config,{httpAuthSchemeParametersProvider:qG,identityProviderConfigProvider:async f=>new MH({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(BH(this.config))}destroy(){super.destroy()}}class E2 extends K1.classBuilder().ep(UP).m(function(e,t,n,i){return[CP(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","InitiateAuth",{}).n("CognitoIdentityProviderClient","InitiateAuthCommand").sc(RQ).build(){}class VQ extends K1.classBuilder().ep(UP).m(function(e,t,n,i){return[CP(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","RespondToAuthChallenge",{}).n("CognitoIdentityProviderClient","RespondToAuthChallengeCommand").sc(OQ).build(){}class $Q{init(e,t,n){this.cognitoClient=new UQ({region:t}),this.spiffRegion=e,this.userPoolClientId=n}async generateCode(e){const t=await this.cognitoClient?.send(new E2({AuthFlow:"CUSTOM_AUTH",ClientId:this.userPoolClientId,AuthParameters:{USERNAME:e}}));t?.ChallengeName==="CUSTOM_CHALLENGE"&&(this.challengeSession=t.Session)}async verifyCode(e,t,n){const i=await this.cognitoClient?.send(new VQ({ClientId:this.userPoolClientId,ChallengeName:"CUSTOM_CHALLENGE",Session:this.challengeSession,ChallengeResponses:{USERNAME:e,ANSWER:t},ClientMetadata:{partnerId:n,environment:(this.spiffRegion||"").toLowerCase()}}));return i?.ChallengeName==="CUSTOM_CHALLENGE"&&(this.challengeSession=i.Session),i}async refreshTokens(){const e=localStorage.getItem("cognito-tokens");if(!e)throw new Error("Failed to find existing tokens.");const t=JSON.parse(e);return await this.cognitoClient?.send(new E2({AuthFlow:"REFRESH_TOKEN_AUTH",ClientId:this.userPoolClientId,AuthParameters:{REFRESH_TOKEN:t.RefreshToken||""}}))}}const Dd=new $Q;var zQ={defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},HQ={globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}};function of(r){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?of=function(e){return typeof e}:of=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},of(r)}function k2(r){return GQ(r)||jQ(r)||qQ(r)||WQ()}function GQ(r){if(Array.isArray(r))return r}function jQ(r){if(typeof Symbol<"u"&&Symbol.iterator in Object(r))return Array.from(r)}function qQ(r,e){if(r){if(typeof r=="string")return T2(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T2(r,e)}}function T2(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function WQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3062
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var QQ={normalizePrecision:function(e){var t=e.reduce(function(n,i){return Math.max(n.getPrecision(),i.getPrecision())});return e.map(function(n){return n.getPrecision()!==t?n.convertPrecision(t):n})},minimum:function(e){var t=k2(e),n=t[0],i=t.slice(1),a=n;return i.forEach(function(s){a=a.lessThan(s)?a:s}),a},maximum:function(e){var t=k2(e),n=t[0],i=t.slice(1),a=n;return i.forEach(function(s){a=a.greaterThan(s)?a:s}),a}};function tD(r){return!isNaN(parseInt(r))&&isFinite(r)}function YQ(r){return tD(r)&&r<=100&&r>=0}function XQ(r){return r.length>0&&r.every(function(e){return e>=0})&&r.some(function(e){return e>0})}function F2(r){return r%2===0}function I2(r){return tD(r)&&!Number.isInteger(r)}function JQ(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=r.toString();if(e.indexOf("e-")>0)return parseInt(e.split("e-")[1]);var t=e.split(".")[1];return t?t.length:0}function Rd(r){return Math.abs(r)%1===.5}function KQ(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(t,n){var i=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){i.readyState===4&&(i.status>=200&&i.status<400?t(JSON.parse(i.responseText)):n(new Error(i.statusText)))},onerror:function(){n(new Error("Network error"))}});i.open("GET",r,!0),ZQ(i,e.headers),i.send()})}function ZQ(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(var t in e)r.setRequestHeader(t,e[t]);return r}function Wd(r){return typeof r>"u"}function rD(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:".",t={};return Object.entries(r).forEach(function(n){if(of(n[1])==="object"){var i=rD(n[1]);Object.entries(i).forEach(function(a){t[n[0]+e+a[0]]=a[1]})}else t[n[0]]=n[1]}),t}function eY(r){return!!r&&(of(r)==="object"||typeof r=="function")&&typeof r.then=="function"}function nD(){var r=function(n,i){var a=function(l){return Math.pow(10,JQ(l))},s=Math.max(a(n),a(i));return Math.round(n*s)*Math.round(i*s)/(s*s)},e={HALF_ODD:function(n){var i=Math.round(n);return Rd(n)&&F2(i)?i-1:i},HALF_EVEN:function(n){var i=Math.round(n);return Rd(n)?F2(i)?i:i-1:i},HALF_UP:function(n){return Math.round(n)},HALF_DOWN:function(n){return Rd(n)?Math.floor(n):Math.round(n)},HALF_TOWARDS_ZERO:function(n){return Rd(n)?Math.sign(n)*Math.floor(Math.abs(n)):Math.round(n)},HALF_AWAY_FROM_ZERO:function(n){return Rd(n)?Math.sign(n)*Math.ceil(Math.abs(n)):Math.round(n)},DOWN:function(n){return Math.floor(n)}};return{add:function(n,i){return n+i},subtract:function(n,i){return n-i},multiply:function(n,i){return I2(n)||I2(i)?r(n,i):n*i},divide:function(n,i){return n/i},modulo:function(n,i){return n%i},round:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"HALF_EVEN";return e[i](n)}}}var tY=nD();function rY(r){var e=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(r);return{getMatches:function(){return e!==null?e.slice(1).filter(function(n){return!Wd(n)}):[]},getMinimumFractionDigits:function(){var n=function(a){return a==="."};return Wd(this.getMatches().find(n))?0:this.getMatches()[tY.add(this.getMatches().findIndex(n),1)].split("").length},getCurrencyDisplay:function(){var n={USD:"code",dollar:"name",$:"symbol"};return n[this.getMatches().find(function(i){return i==="USD"||i==="dollar"||i==="$"})]},getStyle:function(){return Wd(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!Wd(this.getMatches().find(function(n){return n===","}))}}}function nY(r){var e=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;for(var s in a)i=i.replace("{{".concat(s,"}}"),a[s]);return i},t=function(i,a){return KQ(e(r.endpoint,{from:i,to:a}),{headers:r.headers})};return{getExchangeRate:function(i,a){return(eY(r.endpoint)?r.endpoint:t(i,a)).then(function(s){return rD(s)[e(r.propertyPath,{from:i,to:a})]})}}}function Of(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Error;if(!r)throw new t(e)}function iY(r){Of(YQ(r),"You must provide a numeric value between 0 and 100.",RangeError)}function aY(r){Of(XQ(r),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}function sv(r){Of(Number.isInteger(r),"You must provide an integer.",TypeError)}var Tn=nD(),sY=function r(e){var t=Object.assign({},{amount:r.defaultAmount,currency:r.defaultCurrency,precision:r.defaultPrecision},e),n=t.amount,i=t.currency,a=t.precision;sv(n),sv(a);var s=r.globalLocale,o=r.globalFormat,l=r.globalRoundingMode,u=r.globalFormatRoundingMode,c=Object.assign({},r.globalExchangeRatesApi),f=function(g){var y=Object.assign({},Object.assign({},{amount:n,currency:i,precision:a},g),Object.assign({},{locale:this.locale},g));return Object.assign(r({amount:y.amount,currency:y.currency,precision:y.precision}),{locale:y.locale})},d=function(g){Of(this.hasSameCurrency(g),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return n},getCurrency:function(){return i},getLocale:function(){return this.locale||s},setLocale:function(g){return f.call(this,{locale:g})},getPrecision:function(){return a},convertPrecision:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;sv(g);var v=this.getPrecision(),A=g>v,x=A?Tn.multiply:Tn.divide,S=A?[g,v]:[v,g],F=Math.pow(10,Tn.subtract.apply(Tn,S));return f.call(this,{amount:Tn.round(x(this.getAmount(),F),y),precision:g})},add:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return f.call(this,{amount:Tn.add(y[0].getAmount(),y[1].getAmount()),precision:y[0].getPrecision()})},subtract:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return f.call(this,{amount:Tn.subtract(y[0].getAmount(),y[1].getAmount()),precision:y[0].getPrecision()})},multiply:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return f.call(this,{amount:Tn.round(Tn.multiply(this.getAmount(),g),y)})},divide:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return f.call(this,{amount:Tn.round(Tn.divide(this.getAmount(),g),y)})},percentage:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return iY(g),this.multiply(Tn.divide(g,100),y)},allocate:function(g){var y=this;aY(g);for(var v=g.reduce(function(F,E){return Tn.add(F,E)}),A=this.getAmount(),x=g.map(function(F){var E=Math.floor(Tn.divide(Tn.multiply(y.getAmount(),F),v));return A=Tn.subtract(A,E),f.call(y,{amount:E})}),S=0;A>0;)g[S]>0&&(x[S]=x[S].add(f.call(this,{amount:1})),A=Tn.subtract(A,1)),S+=1;return x},convert:function(g){var y=this,v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=v.endpoint,x=A===void 0?c.endpoint:A,S=v.propertyPath,F=S===void 0?c.propertyPath||"rates.{{to}}":S,E=v.headers,R=E===void 0?c.headers:E,O=v.roundingMode,W=O===void 0?l:O,Y=Object.assign({},{endpoint:x,propertyPath:F,headers:R,roundingMode:W});return nY(Y).getExchangeRate(this.getCurrency(),g).then(function(ae){return Of(!Wd(ae),'No rate was found for the destination currency "'.concat(g,'".'),TypeError),f.call(y,{amount:Tn.round(Tn.multiply(y.getAmount(),parseFloat(ae)),Y.roundingMode),currency:g})})},equalsTo:function(g){return this.hasSameAmount(g)&&this.hasSameCurrency(g)},lessThan:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return y[0].getAmount()<y[1].getAmount()},lessThanOrEqual:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return y[0].getAmount()<=y[1].getAmount()},greaterThan:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return y[0].getAmount()>y[1].getAmount()},greaterThanOrEqual:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return y[0].getAmount()>=y[1].getAmount()},isZero:function(){return this.getAmount()===0},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return Tn.modulo(this.getAmount(),Math.pow(10,a))!==0},hasCents:function(){return Tn.modulo(this.getAmount(),Math.pow(10,a))!==0},hasSameCurrency:function(g){return this.getCurrency()===g.getCurrency()},hasSameAmount:function(g){var y=r.normalizePrecision([this,g]);return y[0].getAmount()===y[1].getAmount()},toFormat:function(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:o,y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,v=rY(g);return this.toRoundedUnit(v.getMinimumFractionDigits(),y).toLocaleString(this.getLocale(),{currencyDisplay:v.getCurrencyDisplay(),useGrouping:v.getUseGrouping(),minimumFractionDigits:v.getMinimumFractionDigits(),style:v.getStyle(),currency:this.getCurrency()})},toUnit:function(){return Tn.divide(this.getAmount(),Math.pow(10,a))},toRoundedUnit:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,v=Math.pow(10,g);return Tn.divide(Tn.round(Tn.multiply(this.toUnit(),v),y),v)},toObject:function(){return{amount:n,currency:i,precision:a}},toJSON:function(){return this.toObject()}}},oY=Object.assign(sY,zQ,HQ,QQ),Ka={},ov,P2;function lY(){if(P2)return ov;P2=1;function r(t){return t}function e(t,a,s){for(var a=a||r,s=s||t,o=0,l=t.length;o<l;o+=1)if(a.call(s,t[o],o))return t[o]}return ov=e,ov}var lv={exports:{}},D2;function uY(){if(D2)return lv.exports;D2=1;var r=lv.exports=function(e,t){if(typeof e=="function"||t)return r.by(e,t);for(var n={object:[],function:[],string:{},number:{},boolean:{},undefined:{}},i=[],a=0;a<e.length;a++){var s=e[a],o=s==="__proto__"?n.objects:n[typeof s]||n.objects;Array.isArray(o)?o.indexOf(s)<0&&(o.push(s),i.push(s)):Object.hasOwnProperty.call(o,s)||(o[s]=!0,i.push(s))}return i};return r.by=function(e,t){if(typeof e=="function"){var n=t;t=e,e=n}for(var i=[],a=0;a<e.length;a++){for(var s=e[a],o=!1,l=0;l<i.length;l++){var u=i[l];if(t.call(i,s,u)){o=!0;break}}o||i.push(s)}return i},lv.exports}var uv,R2;function cY(){return R2||(R2=1,uv=[{code:"AED",number:"784",digits:2,currency:"UAE Dirham",countries:["United Arab Emirates (The)"]},{code:"AFN",number:"971",digits:2,currency:"Afghani",countries:["Afghanistan"]},{code:"ALL",number:"008",digits:2,currency:"Lek",countries:["Albania"]},{code:"AMD",number:"051",digits:2,currency:"Armenian Dram",countries:["Armenia"]},{code:"ANG",number:"532",digits:2,currency:"Netherlands Antillean Guilder",countries:["Curaçao","Sint Maarten (Dutch Part)"]},{code:"AOA",number:"973",digits:2,currency:"Kwanza",countries:["Angola"]},{code:"ARS",number:"032",digits:2,currency:"Argentine Peso",countries:["Argentina"]},{code:"AUD",number:"036",digits:2,currency:"Australian Dollar",countries:["Australia","Christmas Island","Cocos (Keeling) Islands (The)","Heard Island and Mcdonald Islands","Kiribati","Nauru","Norfolk Island","Tuvalu"]},{code:"AWG",number:"533",digits:2,currency:"Aruban Florin",countries:["Aruba"]},{code:"AZN",number:"944",digits:2,currency:"Azerbaijan Manat",countries:["Azerbaijan"]},{code:"BAM",number:"977",digits:2,currency:"Convertible Mark",countries:["Bosnia and Herzegovina"]},{code:"BBD",number:"052",digits:2,currency:"Barbados Dollar",countries:["Barbados"]},{code:"BDT",number:"050",digits:2,currency:"Taka",countries:["Bangladesh"]},{code:"BGN",number:"975",digits:2,currency:"Bulgarian Lev",countries:["Bulgaria"]},{code:"BHD",number:"048",digits:3,currency:"Bahraini Dinar",countries:["Bahrain"]},{code:"BIF",number:"108",digits:0,currency:"Burundi Franc",countries:["Burundi"]},{code:"BMD",number:"060",digits:2,currency:"Bermudian Dollar",countries:["Bermuda"]},{code:"BND",number:"096",digits:2,currency:"Brunei Dollar",countries:["Brunei Darussalam"]},{code:"BOB",number:"068",digits:2,currency:"Boliviano",countries:["Bolivia (Plurinational State Of)"]},{code:"BOV",number:"984",digits:2,currency:"Mvdol",countries:["Bolivia (Plurinational State Of)"]},{code:"BRL",number:"986",digits:2,currency:"Brazilian Real",countries:["Brazil"]},{code:"BSD",number:"044",digits:2,currency:"Bahamian Dollar",countries:["Bahamas (The)"]},{code:"BTN",number:"064",digits:2,currency:"Ngultrum",countries:["Bhutan"]},{code:"BWP",number:"072",digits:2,currency:"Pula",countries:["Botswana"]},{code:"BYN",number:"933",digits:2,currency:"Belarusian Ruble",countries:["Belarus"]},{code:"BZD",number:"084",digits:2,currency:"Belize Dollar",countries:["Belize"]},{code:"CAD",number:"124",digits:2,currency:"Canadian Dollar",countries:["Canada"]},{code:"CDF",number:"976",digits:2,currency:"Congolese Franc",countries:["Congo (The Democratic Republic of The)"]},{code:"CHE",number:"947",digits:2,currency:"WIR Euro",countries:["Switzerland"]},{code:"CHF",number:"756",digits:2,currency:"Swiss Franc",countries:["Liechtenstein","Switzerland"]},{code:"CHW",number:"948",digits:2,currency:"WIR Franc",countries:["Switzerland"]},{code:"CLF",number:"990",digits:4,currency:"Unidad de Fomento",countries:["Chile"]},{code:"CLP",number:"152",digits:0,currency:"Chilean Peso",countries:["Chile"]},{code:"CNY",number:"156",digits:2,currency:"Yuan Renminbi",countries:["China"]},{code:"COP",number:"170",digits:2,currency:"Colombian Peso",countries:["Colombia"]},{code:"COU",number:"970",digits:2,currency:"Unidad de Valor Real",countries:["Colombia"]},{code:"CRC",number:"188",digits:2,currency:"Costa Rican Colon",countries:["Costa Rica"]},{code:"CUC",number:"931",digits:2,currency:"Peso Convertible",countries:["Cuba"]},{code:"CUP",number:"192",digits:2,currency:"Cuban Peso",countries:["Cuba"]},{code:"CVE",number:"132",digits:2,currency:"Cabo Verde Escudo",countries:["Cabo Verde"]},{code:"CZK",number:"203",digits:2,currency:"Czech Koruna",countries:["Czechia"]},{code:"DJF",number:"262",digits:0,currency:"Djibouti Franc",countries:["Djibouti"]},{code:"DKK",number:"208",digits:2,currency:"Danish Krone",countries:["Denmark","Faroe Islands (The)","Greenland"]},{code:"DOP",number:"214",digits:2,currency:"Dominican Peso",countries:["Dominican Republic (The)"]},{code:"DZD",number:"012",digits:2,currency:"Algerian Dinar",countries:["Algeria"]},{code:"EGP",number:"818",digits:2,currency:"Egyptian Pound",countries:["Egypt"]},{code:"ERN",number:"232",digits:2,currency:"Nakfa",countries:["Eritrea"]},{code:"ETB",number:"230",digits:2,currency:"Ethiopian Birr",countries:["Ethiopia"]},{code:"EUR",number:"978",digits:2,currency:"Euro",countries:["Åland Islands","Andorra","Austria","Belgium","Croatia","Cyprus","Estonia","European Union","Finland","France","French Guiana","French Southern Territories (The)","Germany","Greece","Guadeloupe","Holy See (The)","Ireland","Italy","Latvia","Lithuania","Luxembourg","Malta","Martinique","Mayotte","Monaco","Montenegro","Netherlands (The)","Portugal","Réunion","Saint Barthélemy","Saint Martin (French Part)","Saint Pierre and Miquelon","San Marino","Slovakia","Slovenia","Spain"]},{code:"FJD",number:"242",digits:2,currency:"Fiji Dollar",countries:["Fiji"]},{code:"FKP",number:"238",digits:2,currency:"Falkland Islands Pound",countries:["Falkland Islands (The) [Malvinas]"]},{code:"GBP",number:"826",digits:2,currency:"Pound Sterling",countries:["Guernsey","Isle of Man","Jersey","United Kingdom of Great Britain and Northern Ireland (The)"]},{code:"GEL",number:"981",digits:2,currency:"Lari",countries:["Georgia"]},{code:"GHS",number:"936",digits:2,currency:"Ghana Cedi",countries:["Ghana"]},{code:"GIP",number:"292",digits:2,currency:"Gibraltar Pound",countries:["Gibraltar"]},{code:"GMD",number:"270",digits:2,currency:"Dalasi",countries:["Gambia (The)"]},{code:"GNF",number:"324",digits:0,currency:"Guinean Franc",countries:["Guinea"]},{code:"GTQ",number:"320",digits:2,currency:"Quetzal",countries:["Guatemala"]},{code:"GYD",number:"328",digits:2,currency:"Guyana Dollar",countries:["Guyana"]},{code:"HKD",number:"344",digits:2,currency:"Hong Kong Dollar",countries:["Hong Kong"]},{code:"HNL",number:"340",digits:2,currency:"Lempira",countries:["Honduras"]},{code:"HTG",number:"332",digits:2,currency:"Gourde",countries:["Haiti"]},{code:"HUF",number:"348",digits:2,currency:"Forint",countries:["Hungary"]},{code:"IDR",number:"360",digits:2,currency:"Rupiah",countries:["Indonesia"]},{code:"ILS",number:"376",digits:2,currency:"New Israeli Sheqel",countries:["Israel"]},{code:"INR",number:"356",digits:2,currency:"Indian Rupee",countries:["Bhutan","India"]},{code:"IQD",number:"368",digits:3,currency:"Iraqi Dinar",countries:["Iraq"]},{code:"IRR",number:"364",digits:2,currency:"Iranian Rial",countries:["Iran (Islamic Republic Of)"]},{code:"ISK",number:"352",digits:0,currency:"Iceland Krona",countries:["Iceland"]},{code:"JMD",number:"388",digits:2,currency:"Jamaican Dollar",countries:["Jamaica"]},{code:"JOD",number:"400",digits:3,currency:"Jordanian Dinar",countries:["Jordan"]},{code:"JPY",number:"392",digits:0,currency:"Yen",countries:["Japan"]},{code:"KES",number:"404",digits:2,currency:"Kenyan Shilling",countries:["Kenya"]},{code:"KGS",number:"417",digits:2,currency:"Som",countries:["Kyrgyzstan"]},{code:"KHR",number:"116",digits:2,currency:"Riel",countries:["Cambodia"]},{code:"KMF",number:"174",digits:0,currency:"Comorian Franc ",countries:["Comoros (The)"]},{code:"KPW",number:"408",digits:2,currency:"North Korean Won",countries:["Korea (The Democratic People’s Republic Of)"]},{code:"KRW",number:"410",digits:0,currency:"Won",countries:["Korea (The Republic Of)"]},{code:"KWD",number:"414",digits:3,currency:"Kuwaiti Dinar",countries:["Kuwait"]},{code:"KYD",number:"136",digits:2,currency:"Cayman Islands Dollar",countries:["Cayman Islands (The)"]},{code:"KZT",number:"398",digits:2,currency:"Tenge",countries:["Kazakhstan"]},{code:"LAK",number:"418",digits:2,currency:"Lao Kip",countries:["Lao People’s Democratic Republic (The)"]},{code:"LBP",number:"422",digits:2,currency:"Lebanese Pound",countries:["Lebanon"]},{code:"LKR",number:"144",digits:2,currency:"Sri Lanka Rupee",countries:["Sri Lanka"]},{code:"LRD",number:"430",digits:2,currency:"Liberian Dollar",countries:["Liberia"]},{code:"LSL",number:"426",digits:2,currency:"Loti",countries:["Lesotho"]},{code:"LYD",number:"434",digits:3,currency:"Libyan Dinar",countries:["Libya"]},{code:"MAD",number:"504",digits:2,currency:"Moroccan Dirham",countries:["Morocco","Western Sahara"]},{code:"MDL",number:"498",digits:2,currency:"Moldovan Leu",countries:["Moldova (The Republic Of)"]},{code:"MGA",number:"969",digits:2,currency:"Malagasy Ariary",countries:["Madagascar"]},{code:"MKD",number:"807",digits:2,currency:"Denar",countries:["North Macedonia"]},{code:"MMK",number:"104",digits:2,currency:"Kyat",countries:["Myanmar"]},{code:"MNT",number:"496",digits:2,currency:"Tugrik",countries:["Mongolia"]},{code:"MOP",number:"446",digits:2,currency:"Pataca",countries:["Macao"]},{code:"MRU",number:"929",digits:2,currency:"Ouguiya",countries:["Mauritania"]},{code:"MUR",number:"480",digits:2,currency:"Mauritius Rupee",countries:["Mauritius"]},{code:"MVR",number:"462",digits:2,currency:"Rufiyaa",countries:["Maldives"]},{code:"MWK",number:"454",digits:2,currency:"Malawi Kwacha",countries:["Malawi"]},{code:"MXN",number:"484",digits:2,currency:"Mexican Peso",countries:["Mexico"]},{code:"MXV",number:"979",digits:2,currency:"Mexican Unidad de Inversion (UDI)",countries:["Mexico"]},{code:"MYR",number:"458",digits:2,currency:"Malaysian Ringgit",countries:["Malaysia"]},{code:"MZN",number:"943",digits:2,currency:"Mozambique Metical",countries:["Mozambique"]},{code:"NAD",number:"516",digits:2,currency:"Namibia Dollar",countries:["Namibia"]},{code:"NGN",number:"566",digits:2,currency:"Naira",countries:["Nigeria"]},{code:"NIO",number:"558",digits:2,currency:"Cordoba Oro",countries:["Nicaragua"]},{code:"NOK",number:"578",digits:2,currency:"Norwegian Krone",countries:["Bouvet Island","Norway","Svalbard and Jan Mayen"]},{code:"NPR",number:"524",digits:2,currency:"Nepalese Rupee",countries:["Nepal"]},{code:"NZD",number:"554",digits:2,currency:"New Zealand Dollar",countries:["Cook Islands (The)","New Zealand","Niue","Pitcairn","Tokelau"]},{code:"OMR",number:"512",digits:3,currency:"Rial Omani",countries:["Oman"]},{code:"PAB",number:"590",digits:2,currency:"Balboa",countries:["Panama"]},{code:"PEN",number:"604",digits:2,currency:"Sol",countries:["Peru"]},{code:"PGK",number:"598",digits:2,currency:"Kina",countries:["Papua New Guinea"]},{code:"PHP",number:"608",digits:2,currency:"Philippine Peso",countries:["Philippines (The)"]},{code:"PKR",number:"586",digits:2,currency:"Pakistan Rupee",countries:["Pakistan"]},{code:"PLN",number:"985",digits:2,currency:"Zloty",countries:["Poland"]},{code:"PYG",number:"600",digits:0,currency:"Guarani",countries:["Paraguay"]},{code:"QAR",number:"634",digits:2,currency:"Qatari Rial",countries:["Qatar"]},{code:"RON",number:"946",digits:2,currency:"Romanian Leu",countries:["Romania"]},{code:"RSD",number:"941",digits:2,currency:"Serbian Dinar",countries:["Serbia"]},{code:"RUB",number:"643",digits:2,currency:"Russian Ruble",countries:["Russian Federation (The)"]},{code:"RWF",number:"646",digits:0,currency:"Rwanda Franc",countries:["Rwanda"]},{code:"SAR",number:"682",digits:2,currency:"Saudi Riyal",countries:["Saudi Arabia"]},{code:"SBD",number:"090",digits:2,currency:"Solomon Islands Dollar",countries:["Solomon Islands"]},{code:"SCR",number:"690",digits:2,currency:"Seychelles Rupee",countries:["Seychelles"]},{code:"SDG",number:"938",digits:2,currency:"Sudanese Pound",countries:["Sudan (The)"]},{code:"SEK",number:"752",digits:2,currency:"Swedish Krona",countries:["Sweden"]},{code:"SGD",number:"702",digits:2,currency:"Singapore Dollar",countries:["Singapore"]},{code:"SHP",number:"654",digits:2,currency:"Saint Helena Pound",countries:["Saint Helena, Ascension and Tristan Da Cunha"]},{code:"SLE",number:"925",digits:2,currency:"Leone",countries:["Sierra Leone"]},{code:"SOS",number:"706",digits:2,currency:"Somali Shilling",countries:["Somalia"]},{code:"SRD",number:"968",digits:2,currency:"Surinam Dollar",countries:["Suriname"]},{code:"SSP",number:"728",digits:2,currency:"South Sudanese Pound",countries:["South Sudan"]},{code:"STN",number:"930",digits:2,currency:"Dobra",countries:["Sao Tome and Principe"]},{code:"SVC",number:"222",digits:2,currency:"El Salvador Colon",countries:["El Salvador"]},{code:"SYP",number:"760",digits:2,currency:"Syrian Pound",countries:["Syrian Arab Republic"]},{code:"SZL",number:"748",digits:2,currency:"Lilangeni",countries:["Eswatini"]},{code:"THB",number:"764",digits:2,currency:"Baht",countries:["Thailand"]},{code:"TJS",number:"972",digits:2,currency:"Somoni",countries:["Tajikistan"]},{code:"TMT",number:"934",digits:2,currency:"Turkmenistan New Manat",countries:["Turkmenistan"]},{code:"TND",number:"788",digits:3,currency:"Tunisian Dinar",countries:["Tunisia"]},{code:"TOP",number:"776",digits:2,currency:"Pa’anga",countries:["Tonga"]},{code:"TRY",number:"949",digits:2,currency:"Turkish Lira",countries:["Türki̇ye"]},{code:"TTD",number:"780",digits:2,currency:"Trinidad and Tobago Dollar",countries:["Trinidad and Tobago"]},{code:"TWD",number:"901",digits:2,currency:"New Taiwan Dollar",countries:["Taiwan (Province of China)"]},{code:"TZS",number:"834",digits:2,currency:"Tanzanian Shilling",countries:["Tanzania, United Republic Of"]},{code:"UAH",number:"980",digits:2,currency:"Hryvnia",countries:["Ukraine"]},{code:"UGX",number:"800",digits:0,currency:"Uganda Shilling",countries:["Uganda"]},{code:"USD",number:"840",digits:2,currency:"US Dollar",countries:["American Samoa","Bonaire, Sint Eustatius and Saba","British Indian Ocean Territory (The)","Ecuador","El Salvador","Guam","Haiti","Marshall Islands (The)","Micronesia (Federated States Of)","Northern Mariana Islands (The)","Palau","Panama","Puerto Rico","Timor-Leste","Turks and Caicos Islands (The)","United States Minor Outlying Islands (The)","United States of America (The)","Virgin Islands (British)","Virgin Islands (u.s.)"]},{code:"USN",number:"997",digits:2,currency:"US Dollar (Next day)",countries:["United States of America (The)"]},{code:"UYI",number:"940",digits:0,currency:"Uruguay Peso en Unidades Indexadas (UI)",countries:["Uruguay"]},{code:"UYU",number:"858",digits:2,currency:"Peso Uruguayo",countries:["Uruguay"]},{code:"UYW",number:"927",digits:4,currency:"Unidad Previsional",countries:["Uruguay"]},{code:"UZS",number:"860",digits:2,currency:"Uzbekistan Sum",countries:["Uzbekistan"]},{code:"VED",number:"926",digits:2,currency:"Bolívar Soberano",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VES",number:"928",digits:2,currency:"Bolívar Soberano",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VND",number:"704",digits:0,currency:"Dong",countries:["Viet Nam"]},{code:"VUV",number:"548",digits:0,currency:"Vatu",countries:["Vanuatu"]},{code:"WST",number:"882",digits:2,currency:"Tala",countries:["Samoa"]},{code:"XAF",number:"950",digits:0,currency:"CFA Franc BEAC",countries:["Cameroon","Central African Republic (The)","Chad","Congo (The)","Equatorial Guinea","Gabon"]},{code:"XAG",number:"961",digits:0,currency:"Silver",countries:["Zz11_silver"]},{code:"XAU",number:"959",digits:0,currency:"Gold",countries:["Zz08_gold"]},{code:"XBA",number:"955",digits:0,currency:"Bond Markets Unit European Composite Unit (EURCO)",countries:["Zz01_bond Markets Unit European_eurco"]},{code:"XBB",number:"956",digits:0,currency:"Bond Markets Unit European Monetary Unit (E.M.U.-6)",countries:["Zz02_bond Markets Unit European_emu-6"]},{code:"XBC",number:"957",digits:0,currency:"Bond Markets Unit European Unit of Account 9 (E.U.A.-9)",countries:["Zz03_bond Markets Unit European_eua-9"]},{code:"XBD",number:"958",digits:0,currency:"Bond Markets Unit European Unit of Account 17 (E.U.A.-17)",countries:["Zz04_bond Markets Unit European_eua-17"]},{code:"XCD",number:"951",digits:2,currency:"East Caribbean Dollar",countries:["Anguilla","Antigua and Barbuda","Dominica","Grenada","Montserrat","Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines"]},{code:"XDR",number:"960",digits:0,currency:"SDR (Special Drawing Right)",countries:["International Monetary Fund (Imf) "]},{code:"XOF",number:"952",digits:0,currency:"CFA Franc BCEAO",countries:["Benin","Burkina Faso","Côte D'ivoire","Guinea-Bissau","Mali","Niger (The)","Senegal","Togo"]},{code:"XPD",number:"964",digits:0,currency:"Palladium",countries:["Zz09_palladium"]},{code:"XPF",number:"953",digits:0,currency:"CFP Franc",countries:["French Polynesia","New Caledonia","Wallis and Futuna"]},{code:"XPT",number:"962",digits:0,currency:"Platinum",countries:["Zz10_platinum"]},{code:"XSU",number:"994",digits:0,currency:"Sucre",countries:['Sistema Unitario De Compensacion Regional De Pagos "Sucre"']},{code:"XTS",number:"963",digits:0,currency:"Codes specifically reserved for testing purposes",countries:["Zz06_testing_code"]},{code:"XUA",number:"965",digits:0,currency:"ADB Unit of Account",countries:["Member Countries of the African Development Bank Group"]},{code:"XXX",number:"999",digits:0,currency:"The codes assigned for transactions where no currency is involved",countries:["Zz07_no_currency"]},{code:"YER",number:"886",digits:2,currency:"Yemeni Rial",countries:["Yemen"]},{code:"ZAR",number:"710",digits:2,currency:"Rand",countries:["Lesotho","Namibia","South Africa"]},{code:"ZMW",number:"967",digits:2,currency:"Zambian Kwacha",countries:["Zambia"]},{code:"ZWG",number:"924",digits:2,currency:"Zimbabwe Gold",countries:["Zimbabwe"]}]),uv}var cv,O2;function dY(){return O2||(O2=1,cv="2024-06-25"),cv}var B2;function fY(){if(B2)return Ka;B2=1;var r=lY(),e=uY(),t=cY(),n=dY(),i=function(c){return c=c.toUpperCase(),r(t,function(f){return f.code===c})},a=function(c){return c=c.toLowerCase(),t.filter(function(f){return(f.countries.map(function(d){return d.toLowerCase()})||[]).indexOf(c)>-1})},s=function(c){return r(t,function(f){return f.number===String(c)})},o=function(){return t.map(function(c){return c.code})},l=function(){var c=t.map(function(f){return f.number});return c.filter(function(f){if(f)return f})},u=function(){var c=t.filter(function(f){return f.countries}).map(function(f){return f.countries});return e(Array.prototype.concat.apply([],c))};return Ka.code=i,Ka.country=a,Ka.number=s,Ka.codes=o,Ka.numbers=l,Ka.countries=u,Ka.publishDate=n,Ka.data=t,Ka}var M2=fY();class iD{formatCurrencyForDisplay(e,t){const n={amount:t||0,currency:e,precision:this.getPrecisionForCurrency(e)};return oY(n).toFormat(this.getSpecialFormat(e))}getPrecisionForCurrency(e){const t=e,n=M2.code(t);return n?n.digits:2}getSpecialFormat(e){const t=e;if(M2.code(t)?.code==="CLP")return"USD0,0"}}const _2=new iD;class aD{constructor(e,t,n,i){this.presentmentCurrency=void 0,this.presentmentCurrency=i,this.partnerCurrency=n,this.rateFrom=e,this.rateTo=t}code(){return this.presentmentCurrency?this.presentmentCurrency:this.partnerCurrency}conversionRequired(){return this.presentmentCurrency!==void 0&&this.code()!==this.partnerCurrency}getConvertedSubunits(e){return this.conversionRequired()?Math.ceil(this.subunits(this.units(e,this.partnerCurrency)/this.rateFrom*this.rateTo,this.code())):e}units(e,t){return e/Math.pow(10,_2.getPrecisionForCurrency(t))}subunits(e,t){return e*Math.pow(10,_2.getPrecisionForCurrency(t))}}const hY=Ce`
|
|
3063
|
+
${xo(s)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const t=[];for(const a of e.split("/"))a?.length!==0&&a!=="."&&(a===".."?t.pop():t.push(a));const n=`${e?.startsWith("/")?"/":""}${t.join("/")}${t.length>0&&e?.endsWith("/")?"/":""}`;return kl(n).replace(/%2F/g,"/")}return e}validateResolvedCredentials(e){if(typeof e!="object"||typeof e.accessKeyId!="string"||typeof e.secretAccessKey!="string")throw new Error("Resolved credential object is not valid")}formatDate(e){const t=LG(e).replace(/[\-:]/g,"");return{longDate:t,shortDate:t.slice(0,8)}}getCanonicalHeaderList(e){return Object.keys(e).sort().join(";")}}const Dp={},Ky=[],Zy=(r,e,t)=>`${r}/${e}/${t}/${LP}`,$G=async(r,e,t,n,i)=>{const a=await f2(r,e.secretAccessKey,e.accessKeyId),s=`${t}:${n}:${i}:${xo(a)}:${e.sessionToken}`;if(s in Dp)return Dp[s];for(Ky.push(s);Ky.length>MG;)delete Dp[Ky.shift()];let o=`AWS4${e.secretAccessKey}`;for(const l of[t,n,i,LP])o=await f2(r,o,l);return Dp[s]=o},f2=(r,e,t)=>{const n=new r(e);return n.update(Pf(t)),n.digest()},h2=({headers:r},e,t)=>{const n={};for(const i of Object.keys(r).sort()){if(r[i]==null)continue;const a=i.toLowerCase();(a in PG||e?.has(a)||DG.test(a)||RG.test(a))&&(!t||t&&!t.has(a))||(n[a]=r[i].trim().replace(/\s+/g," "))}return n},ev=async({headers:r,body:e},t)=>{for(const n of Object.keys(r))if(n.toLowerCase()===RA)return r[n];if(e==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";if(typeof e=="string"||ArrayBuffer.isView(e)||J$(e)){const n=new t;return n.update(Pf(e)),xo(await n.digest())}return BG},zG=(r,e)=>{r=r.toLowerCase();for(const t of Object.keys(e))if(r===t.toLowerCase())return!0;return!1},HG=(r,e={})=>{const{headers:t,query:n={}}=aa.clone(r);for(const i of Object.keys(t)){const a=i.toLowerCase();(a.slice(0,6)==="x-amz-"&&!e.unhoistableHeaders?.has(a)||e.hoistableHeaders?.has(a))&&(n[i]=t[i],delete t[i])}return{...r,headers:t,query:n}},p2=r=>{r=aa.clone(r);for(const e of Object.keys(r.headers))TG.indexOf(e.toLowerCase())>-1&&delete r.headers[e];return r};class g2 extends VG{headerFormatter=new bG;constructor({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:s=!0}){super({applyChecksum:e,credentials:t,region:n,service:i,sha256:a,uriEscapePath:s})}async presign(e,t={}){const{signingDate:n=new Date,expiresIn:i=3600,unsignableHeaders:a,unhoistableHeaders:s,signableHeaders:o,hoistableHeaders:l,signingRegion:u,signingService:c}=t,f=await this.credentialProvider();this.validateResolvedCredentials(f);const d=u??await this.regionProvider(),{longDate:h,shortDate:g}=this.formatDate(n);if(i>_G)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const y=Zy(g,d,c??this.service),v=HG(p2(e),{unhoistableHeaders:s,hoistableHeaders:l});f.sessionToken&&(v.query[MP]=f.sessionToken),v.query[xG]=Jy,v.query[CG]=`${f.accessKeyId}/${y}`,v.query[OP]=h,v.query[EG]=i.toString(10);const A=h2(v,a,o);return v.query[SG]=this.getCanonicalHeaderList(A),v.query[BP]=await this.getSignature(h,y,this.getSigningKey(f,d,g,c),this.createCanonicalRequest(v,A,await ev(e,this.sha256))),v}async sign(e,t){return typeof e=="string"?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:i,signingRegion:a,signingService:s,eventStreamCredentials:o}){const l=a??await this.regionProvider(),{shortDate:u,longDate:c}=this.formatDate(n),f=Zy(u,l,s??this.service),d=await ev({headers:{},body:t},this.sha256),h=new this.sha256;h.update(e);const g=xo(await h.digest()),y=[OG,c,f,i,g,d].join(`
|
|
3064
|
+
`);return this.signString(y,{signingDate:n,signingRegion:l,signingService:s,eventStreamCredentials:o})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:i,eventStreamCredentials:a}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:i,priorSignature:e.priorSignature,eventStreamCredentials:a}).then(o=>({message:e.message,signature:o}))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:i,eventStreamCredentials:a}={}){const s=a??await this.credentialProvider();this.validateResolvedCredentials(s);const o=n??await this.regionProvider(),{shortDate:l}=this.formatDate(t),u=new this.sha256(await this.getSigningKey(s,o,l,i));return u.update(Pf(e)),xo(await u.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:i,signingRegion:a,signingService:s}={}){const o=await this.credentialProvider();this.validateResolvedCredentials(o);const l=a??await this.regionProvider(),u=p2(e),{longDate:c,shortDate:f}=this.formatDate(t),d=Zy(f,l,s??this.service);u.headers[NP]=c,o.sessionToken&&(u.headers[IG]=o.sessionToken);const h=await ev(u,this.sha256);!zG(RA,u.headers)&&this.applyChecksum&&(u.headers[RA]=h);const g=h2(u,i,n),y=await this.getSignature(c,d,this.getSigningKey(o,l,f,s),this.createCanonicalRequest(u,g,h));return u.headers[_P]=`${Jy} Credential=${o.accessKeyId}/${d}, SignedHeaders=${this.getCanonicalHeaderList(g)}, Signature=${y}`,u}async getSignature(e,t,n,i){const a=await this.createStringToSign(e,t,i,Jy),s=new this.sha256(await n);return s.update(Pf(a)),xo(await s.digest())}getSigningKey(e,t,n,i){return $G(this.sha256,e,n,t,i||this.service)}}const GG=r=>{let e=r.credentials,t=!!r.credentials,n;Object.defineProperty(r,"credentials",{set(u){u&&u!==e&&u!==n&&(t=!0),e=u;const c=jG(r,{credentials:e,credentialDefaultProvider:r.credentialDefaultProvider}),f=qG(r,c);if(t&&!f.attributed){const d=typeof e=="object"&&e!==null;n=async h=>{const y=await f(h);return d&&(!y.$source||Object.keys(y.$source).length===0)?e$(y,"CREDENTIALS_CODE","e"):y},n.memoized=f.memoized,n.configBound=f.configBound,n.attributed=!0}else n=f},get(){return n},enumerable:!0,configurable:!0}),r.credentials=e;const{signingEscapePath:i=!0,systemClockOffset:a=r.systemClockOffset||0,sha256:s}=r;let o;return r.signer?o=af(r.signer):r.regionInfoProvider?o=()=>af(r.region)().then(async u=>[await r.regionInfoProvider(u,{useFipsEndpoint:await r.useFipsEndpoint(),useDualstackEndpoint:await r.useDualstackEndpoint()})||{},u]).then(([u,c])=>{const{signingRegion:f,signingService:d}=u;r.signingRegion=r.signingRegion||f||c,r.signingName=r.signingName||d||r.serviceId;const h={...r,credentials:r.credentials,region:r.signingRegion,service:r.signingName,sha256:s,uriEscapePath:i},g=r.signerConstructor||g2;return new g(h)}):o=async u=>{u=Object.assign({},{name:"sigv4",signingName:r.signingName||r.defaultSigningName,signingRegion:await af(r.region)(),properties:{}},u);const c=u.signingRegion,f=u.signingName;r.signingRegion=r.signingRegion||c,r.signingName=r.signingName||f||r.serviceId;const d={...r,credentials:r.credentials,region:r.signingRegion,service:r.signingName,sha256:s,uriEscapePath:i},h=r.signerConstructor||g2;return new h(d)},Object.assign(r,{systemClockOffset:a,signingEscapePath:i,signer:o})};function jG(r,{credentials:e,credentialDefaultProvider:t}){let n;return e?e?.memoized?n=e:n=$H(e,VH,FP):t?n=af(t(Object.assign({},r,{parentClientConfig:r}))):n=async()=>{throw new Error("@aws-sdk/core::resolveAwsSdkSigV4Config - `credentials` not provided and no credentialDefaultProvider was configured.")},n.memoized=!0,n}function qG(r,e){if(e.configBound)return e;const t=async n=>e({...n,callerClientConfig:r});return t.memoized=e.memoized,t.configBound=!0,t}const WG=async(r,e,t)=>({operation:Ac(e).operation,region:await _s(r.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()});function QG(r){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"cognito-idp",region:r.region},propertiesExtractor:(e,t)=>({signingProperties:{config:e,context:t}})}}function Ur(r){return{schemeId:"smithy.api#noAuth"}}const YG=r=>{const e=[];switch(r.operation){case"AssociateSoftwareToken":{e.push(Ur());break}case"ChangePassword":{e.push(Ur());break}case"CompleteWebAuthnRegistration":{e.push(Ur());break}case"ConfirmDevice":{e.push(Ur());break}case"ConfirmForgotPassword":{e.push(Ur());break}case"ConfirmSignUp":{e.push(Ur());break}case"DeleteUser":{e.push(Ur());break}case"DeleteUserAttributes":{e.push(Ur());break}case"DeleteWebAuthnCredential":{e.push(Ur());break}case"ForgetDevice":{e.push(Ur());break}case"ForgotPassword":{e.push(Ur());break}case"GetDevice":{e.push(Ur());break}case"GetTokensFromRefreshToken":{e.push(Ur());break}case"GetUser":{e.push(Ur());break}case"GetUserAttributeVerificationCode":{e.push(Ur());break}case"GetUserAuthFactors":{e.push(Ur());break}case"GlobalSignOut":{e.push(Ur());break}case"InitiateAuth":{e.push(Ur());break}case"ListDevices":{e.push(Ur());break}case"ListWebAuthnCredentials":{e.push(Ur());break}case"ResendConfirmationCode":{e.push(Ur());break}case"RespondToAuthChallenge":{e.push(Ur());break}case"RevokeToken":{e.push(Ur());break}case"SetUserMFAPreference":{e.push(Ur());break}case"SetUserSettings":{e.push(Ur());break}case"SignUp":{e.push(Ur());break}case"StartWebAuthnRegistration":{e.push(Ur());break}case"UpdateAuthEventFeedback":{e.push(Ur());break}case"UpdateDeviceStatus":{e.push(Ur());break}case"UpdateUserAttributes":{e.push(Ur());break}case"VerifySoftwareToken":{e.push(Ur());break}case"VerifyUserAttribute":{e.push(Ur());break}default:e.push(QG(r))}return e},XG=r=>{const e=GG(r);return Object.assign(e,{authSchemePreference:_s(r.authSchemePreference??[])})},JG=r=>Object.assign(r,{useDualstackEndpoint:r.useDualstackEndpoint??!1,useFipsEndpoint:r.useFipsEndpoint??!1,defaultSigningName:"cognito-idp"}),UP={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}},KG="3.1075.0",ZG={version:KG},ej=r=>new TextEncoder().encode(r);var tj=typeof Buffer<"u"&&Buffer.from?function(r){return Buffer.from(r,"utf8")}:ej;function Df(r){return r instanceof Uint8Array?r:typeof r=="string"?tj(r):ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(r)}function OA(r){return typeof r=="string"?r.length===0:r.byteLength===0}var VP={name:"SHA-256"},m2={name:"HMAC",hash:VP},rj=new Uint8Array([227,176,196,66,152,252,28,20,154,251,244,200,153,111,185,36,39,174,65,228,100,155,147,76,164,149,153,27,120,82,184,85]);const nj={};function ig(){return typeof window<"u"?window:typeof self<"u"?self:nj}var ij=(function(){function r(e){this.toHash=new Uint8Array(0),this.secret=e,this.reset()}return r.prototype.update=function(e){if(!OA(e)){var t=Df(e),n=new Uint8Array(this.toHash.byteLength+t.byteLength);n.set(this.toHash,0),n.set(t,this.toHash.byteLength),this.toHash=n}},r.prototype.digest=function(){var e=this;return this.key?this.key.then(function(t){return ig().crypto.subtle.sign(m2,t,e.toHash).then(function(n){return new Uint8Array(n)})}):OA(this.toHash)?Promise.resolve(rj):Promise.resolve().then(function(){return ig().crypto.subtle.digest(VP,e.toHash)}).then(function(t){return Promise.resolve(new Uint8Array(t))})},r.prototype.reset=function(){var e=this;this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0&&(this.key=new Promise(function(t,n){ig().crypto.subtle.importKey("raw",Df(e.secret),m2,!1,["sign"]).then(t,n)}),this.key.catch(function(){}))},r})(),ga=64,aj=32,sj=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),oj=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],lj=Math.pow(2,53)-1,ag=(function(){function r(){this.state=Int32Array.from(oj),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return r.prototype.update=function(e){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,n=e.byteLength;if(this.bytesHashed+=n,this.bytesHashed*8>lj)throw new Error("Cannot hash more than 2^53 - 1 bits");for(;n>0;)this.buffer[this.bufferLength++]=e[t++],n--,this.bufferLength===ga&&(this.hashBuffer(),this.bufferLength=0)},r.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),n=this.bufferLength;if(t.setUint8(this.bufferLength++,128),n%ga>=ga-8){for(var i=this.bufferLength;i<ga;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<ga-8;i++)t.setUint8(i,0);t.setUint32(ga-8,Math.floor(e/4294967296),!0),t.setUint32(ga-4,e),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(aj),i=0;i<8;i++)a[i*4]=this.state[i]>>>24&255,a[i*4+1]=this.state[i]>>>16&255,a[i*4+2]=this.state[i]>>>8&255,a[i*4+3]=this.state[i]>>>0&255;return a},r.prototype.hashBuffer=function(){for(var e=this,t=e.buffer,n=e.state,i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],u=n[5],c=n[6],f=n[7],d=0;d<ga;d++){if(d<16)this.temp[d]=(t[d*4]&255)<<24|(t[d*4+1]&255)<<16|(t[d*4+2]&255)<<8|t[d*4+3]&255;else{var h=this.temp[d-2],g=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=this.temp[d-15];var y=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;this.temp[d]=(g+this.temp[d-7]|0)+(y+this.temp[d-16]|0)}var v=(((l>>>6|l<<26)^(l>>>11|l<<21)^(l>>>25|l<<7))+(l&u^~l&c)|0)+(f+(sj[d]+this.temp[d]|0)|0)|0,A=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&s^a&s)|0;f=c,c=u,u=l,l=o+v|0,o=s,s=a,a=i,i=v+A|0}n[0]+=i,n[1]+=a,n[2]+=s,n[3]+=o,n[4]+=l,n[5]+=u,n[6]+=c,n[7]+=f},r})(),uj=(function(){function r(e){this.secret=e,this.hash=new ag,this.reset()}return r.prototype.update=function(e){if(!(OA(e)||this.error))try{this.hash.update(Df(e))}catch(t){this.error=t}},r.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},r.prototype.digest=function(){return rs(this,void 0,void 0,function(){return ns(this,function(e){return[2,this.digestSync()]})})},r.prototype.reset=function(){if(this.hash=new ag,this.secret){this.outer=new ag;var e=cj(this.secret),t=new Uint8Array(ga);t.set(e);for(var n=0;n<ga;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(var n=0;n<e.byteLength;n++)e[n]=0}},r})();function cj(r){var e=Df(r);if(e.byteLength>ga){var t=new ag;t.update(e),e=t.digest()}var n=new Uint8Array(ga);return n.set(e),n}var dj=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];function fj(r){if(hj(r)&&typeof r.crypto.subtle=="object"){var e=r.crypto.subtle;return pj(e)}return!1}function hj(r){if(typeof r=="object"&&typeof r.crypto=="object"){var e=r.crypto.getRandomValues;return typeof e=="function"}return!1}function pj(r){return r&&dj.every(function(e){return typeof r[e]=="function"})}var gj=(function(){function r(e){fj(ig())?this.hash=new ij(e):this.hash=new uj(e)}return r.prototype.update=function(e,t){this.hash.update(Df(e))},r.prototype.digest=function(){return this.hash.digest()},r.prototype.reset=function(){this.hash.reset()},r})();function y2(r,e){return new Request(r,e)}function mj(r=0){return new Promise((e,t)=>{r&&setTimeout(()=>{const n=new Error(`Request did not complete within ${r} ms`);n.name="TimeoutError",t(n)},r)})}const tv={supported:void 0};class ab{config;configProvider;static create(e){return typeof e?.handle=="function"?e:new ab(e)}constructor(e){typeof e=="function"?this.configProvider=e().then(t=>t||{}):(this.config=e??{},this.configProvider=Promise.resolve(this.config)),tv.supported===void 0&&(tv.supported=typeof Request<"u"&&"keepalive"in y2("https://[::1]"))}destroy(){}async handle(e,{abortSignal:t,requestTimeout:n}={}){this.config||(this.config=await this.configProvider);const i=n??this.config.requestTimeout,a=this.config.keepAlive===!0,s=this.config.credentials;if(t?.aborted){const x=v2(t);return Promise.reject(x)}let o=e.path;const l=jz(e.query||{});l&&(o+=`?${l}`),e.fragment&&(o+=`#${e.fragment}`);let u="";if(e.username!=null||e.password!=null){const x=e.username??"",S=e.password??"";u=`${x}:${S}@`}const{port:c,method:f}=e,d=`${e.protocol}//${u}${e.hostname}${c?`:${c}`:""}${o}`,h=f==="GET"||f==="HEAD"?void 0:e.body,g={body:h,headers:new Headers(e.headers),method:f,credentials:s};this.config?.cache&&(g.cache=this.config.cache),h&&(g.duplex="half"),typeof AbortController<"u"&&(g.signal=t),tv.supported&&(g.keepalive=a),typeof this.config.requestInit=="function"&&Object.assign(g,this.config.requestInit(e));let y=()=>{};const v=y2(d,g),A=[fetch(v).then(x=>{const S=x.headers,F={};for(const R of S.entries())F[R[0]]=R[1];return x.body!=null?{response:new oc({headers:F,reason:x.statusText,statusCode:x.status,body:x.body})}:x.blob().then(R=>({response:new oc({headers:F,reason:x.statusText,statusCode:x.status,body:R})}))}),mj(i)];return t&&A.push(new Promise((x,S)=>{const F=()=>{const E=v2(t);S(E)};if(typeof t.addEventListener=="function"){const E=t;E.addEventListener("abort",F,{once:!0}),y=()=>E.removeEventListener("abort",F)}else t.onabort=F})),Promise.race(A).finally(y)}updateHttpClientConfig(e,t){this.config=void 0,this.configProvider=this.configProvider.then(n=>(n[e]=t,n))}httpHandlerConfigs(){return this.config??{}}}function v2(r){const e=r&&typeof r=="object"&&"reason"in r?r.reason:void 0;if(e){if(e instanceof Error){const i=new Error("Request aborted");return i.name="AbortError",i.cause=e,i}const n=new Error(String(e));return n.name="AbortError",n}const t=new Error("Request aborted");return t.name="AbortError",t}const yj=async r=>typeof Blob=="function"&&r instanceof Blob||r.constructor?.name==="Blob"?Blob.prototype.arrayBuffer!==void 0?new Uint8Array(await r.arrayBuffer()):vj(r):Aj(r);async function vj(r){const e=await bj(r),t=im(e);return new Uint8Array(t)}async function Aj(r){const e=[],t=r.getReader();let n=!1,i=0;for(;!n;){const{done:o,value:l}=await t.read();l&&(e.push(l),i+=l.length),n=o}const a=new Uint8Array(i);let s=0;for(const o of e)a.set(o,s),s+=o.length;return a}function bj(r){return new Promise((e,t)=>{const n=new FileReader;n.onloadend=()=>{if(n.readyState!==2)return t(new Error("Reader aborted too early"));const i=n.result??"",a=i.indexOf(","),s=a>-1?a+1:i.length;e(i.substring(s))},n.onabort=()=>t(new Error("Read aborted")),n.onerror=()=>t(n.error),n.readAsDataURL(r)})}class wj{queryCompat;errorRegistry;constructor(e=!1){this.queryCompat=e}resolveRestContentType(e,t){const n=t.getMemberSchemas(),i=Object.values(n).find(a=>!!a.getMergedTraits().httpPayload);if(i){const a=i.getMergedTraits().mediaType;return a||(i.isStringSchema()?"text/plain":i.isBlobSchema()?"application/octet-stream":e)}else if(!t.isUnitSchema()&&Object.values(n).find(s=>{const{httpQuery:o,httpQueryParams:l,httpHeader:u,httpLabel:c,httpPrefixHeaders:f}=s.getMergedTraits();return!o&&!l&&!u&&!c&&f===void 0}))return e}async getErrorSchemaOrThrowBaseException(e,t,n,i,a,s){let o=e;e.includes("#")&&([,o]=e.split("#"));const l={$metadata:a,$fault:n.statusCode<500?"client":"server"};if(!this.errorRegistry)throw new Error("@aws-sdk/core/protocols - error handler not initialized.");try{return{errorSchema:s?.(this.errorRegistry,o)??this.errorRegistry.getSchema(e),errorMetadata:l}}catch{i.message=i.message??i.Message??"UnknownError";const c=this.errorRegistry,f=c.getBaseException();if(f){const g=c.getErrorCtor(f)??Error;throw this.decorateServiceException(Object.assign(new g({name:o}),l),i)}const d=i,h=d?.message??d?.Message??d?.Error?.Message??d?.Error?.message;throw this.decorateServiceException(Object.assign(new Error(h),{name:o},l),i)}}compose(e,t,n){let i=n;t.includes("#")&&([i]=t.split("#"));const a=ta.for(i),s=ta.for("smithy.ts.sdk.synthetic."+n);e.copyFrom(a),e.copyFrom(s),this.errorRegistry=e}decorateServiceException(e,t={}){if(this.queryCompat){const n=e.Message??t.Message,i=qE(e,t);n&&(i.message=n);const a=i.Error??{};a.Type=i.Error?.Type,a.Code=i.Error?.Code,a.Message=i.Error?.message??i.Error?.Message??n,i.Error=a;const s=i.$metadata.requestId;return s&&(i.RequestId=s),i}return qE(e,t)}setQueryCompatError(e,t){const n=t.headers?.["x-amzn-query-error"];if(e!==void 0&&n!=null){const[i,a]=n.split(";"),s=Object.keys(e),o={Code:i,Type:a};e.Code=i,e.Type=a;for(let l=0;l<s.length;l++){const u=s[l];o[u==="message"?"Message":u]=e[u]}delete o.__type,e.Error=o}}queryCompatOutput(e,t){e.Error&&(t.Error=e.Error),e.Type&&(t.Type=e.Type),e.Code&&(t.Code=e.Code)}findQueryCompatibleError(e,t){try{return e.getSchema(t)}catch{return e.find(i=>yi.of(i).getMergedTraits().awsQueryError?.[0]===t)}}}class sb{serdeContext;setSerdeContext(e){this.serdeContext=e}}class xj{from;to;keys;constructor(e,t){this.from=e,this.to=t;const n=Object.keys(this.from),i=new Set(n);i.delete("__type"),this.keys=i}mark(e){this.keys.delete(e)}hasUnknown(){return this.keys.size===1&&Object.keys(this.to).length===0}writeUnknown(){if(this.hasUnknown()){const e=this.keys.values().next().value,t=this.from[e];this.to.$unknown=[e,t]}}}function Cj(r,e,t){if(t?.source){const n=t.source;if(typeof e=="number"&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER||n!==String(e)))return n.includes(".")?new as(n,"bigDecimal"):BigInt(n)}return e}const Sj=(r,e)=>PA(r,e).then(t=>(e?.utf8Encoder??am)(t)),Ej=(r,e)=>Sj(r,e).then(t=>{if(t.length)try{return JSON.parse(t)}catch(n){throw n?.name==="SyntaxError"&&Object.defineProperty(n,"$responseBodyText",{value:t}),n}return{}}),A2=(r,e)=>Object.keys(r).find(t=>t.toLowerCase()===e.toLowerCase()),rv=r=>{let e=r;return typeof e=="number"&&(e=e.toString()),e.indexOf(",")>=0&&(e=e.split(",")[0]),e.indexOf(":")>=0&&(e=e.split(":")[0]),e.indexOf("#")>=0&&(e=e.split("#")[1]),e},kj=(r,e,t=!1)=>Tj(r,e,t?["code","header","type"]:["type","code","header"]),Tj=({headers:r},e,t)=>{for(;t.length>0;)switch(t.shift()){case"header":const i=A2(r??{},"x-amzn-errortype");if(i!==void 0)return rv(r[i]);break;case"code":const a=A2(e??{},"code");if(a&&e[a]!==void 0)return rv(e[a]);break;case"type":if(e?.__type!==void 0)return rv(e.__type);break}};class Fj extends sb{settings;constructor(e){super(),this.settings=e}async read(e,t){return this._read(e,typeof t=="string"?JSON.parse(t,Cj):await Ej(t,this.serdeContext))}readObject(e,t){return this._read(e,t)}_read(e,t){const n=t!==null&&typeof t=="object",i=yi.of(e);if(n){if(i.isStructSchema()){const s=t,o=i.isUnionSchema(),l={};let u;const{jsonName:c}=this.settings;c&&(u={});let f;o&&(f=new xj(s,l));for(const[d,h]of i.structIterator()){let g=d;c&&(g=h.getMergedTraits().jsonName??g,u[g]=d),o&&f.mark(g),s[g]!=null&&(l[d]=this._read(h,s[g]))}if(o)f.writeUnknown();else if(typeof s.__type=="string")for(const d in s){const h=s[d],g=c?u[d]??d:d;g in l||(l[g]=h)}return l}if(Array.isArray(t)&&i.isListSchema()){const s=i.getValueSchema(),o=[];for(const l of t)o.push(this._read(s,l));return o}if(i.isMapSchema()){const s=i.getValueSchema(),o={};for(const l in t)o[l]=this._read(s,t[l]);return o}}if(i.isBlobSchema()&&typeof t=="string")return im(t);const a=i.getMergedTraits().mediaType;if(i.isStringSchema()&&typeof t=="string"&&a)return a==="application/json"||a.endsWith("+json")?yo.from(t):t;if(i.isTimestampSchema()&&t!=null)switch(EP(i,this.settings)){case 5:return N$(t);case 6:return dP(t);case 7:return $$(t);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",t),new Date(t)}if(i.isBigIntegerSchema()&&(typeof t=="number"||typeof t=="string"))return BigInt(t);if(i.isBigDecimalSchema()&&t!=null){if(t instanceof as)return t;const s=t;return s.type==="bigDecimal"&&"string"in s?new as(s.string,s.type):new as(String(t),"bigDecimal")}if(i.isNumericSchema()&&typeof t=="string"){switch(t){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return t}if(i.isDocumentSchema())if(n){const s=Array.isArray(t)?[]:{};for(const o in t){const l=t[o];l instanceof as?s[o]=l:s[o]=this._read(i,l)}return s}else return structuredClone(t);return t}}const b2="Ν";class Ij{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(e,t)=>{if(t instanceof as){const n=`${b2+"nv"+this.counter++}_`+t.string;return this.values.set(`"${n}"`,t.string),n}if(typeof t=="bigint"){const n=t.toString(),i=`${b2+"b"+this.counter++}_`+n;return this.values.set(`"${i}"`,n),i}return t}}replaceInJson(e){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return e;for(const[t,n]of this.values)e=e.replace(t,n);return e}}class Pj extends sb{settings;buffer;useReplacer=!1;rootSchema;constructor(e){super(),this.settings=e}write(e,t){this.rootSchema=yi.of(e),this.buffer=this._write(this.rootSchema,t)}flush(){const{rootSchema:e,useReplacer:t}=this;if(this.rootSchema=void 0,this.useReplacer=!1,e?.isStructSchema()||e?.isDocumentSchema()){if(!t)return JSON.stringify(this.buffer);const n=new Ij;return n.replaceInJson(JSON.stringify(this.buffer,n.createReplacer(),0))}return this.buffer}writeDiscriminatedDocument(e,t){this.write(e,t),typeof this.buffer=="object"&&(this.buffer.__type=yi.of(e).getName(!0))}_write(e,t,n){const i=t!==null&&typeof t=="object",a=yi.of(e);if(i){if(a.isStructSchema()){const s=t,o={},{jsonName:l}=this.settings;let u;l&&(u={});let c=0;for(const[f,d]of a.structIterator()){const h=this._write(d,s[f],a);if(h!==void 0){let g=f;l&&(g=d.getMergedTraits().jsonName??f,u[f]=g),o[g]=h,c++}}if(a.isUnionSchema()&&c===0){const{$unknown:f}=s;if(Array.isArray(f)){const[d,h]=f;o[d]=this._write(15,h)}}else if(typeof s.__type=="string")for(const f in s){const d=s[f],h=l?u[f]??f:f;h in o||(o[h]=this._write(15,d))}return o}if(Array.isArray(t)&&a.isListSchema()){const s=a.getValueSchema(),o=[],l=!!a.getMergedTraits().sparse;for(const u of t)(l||u!=null)&&o.push(this._write(s,u));return o}if(a.isMapSchema()){const s=a.getValueSchema(),o={},l=!!a.getMergedTraits().sparse;for(const u in t){const c=t[u];(l||c!=null)&&(o[u]=this._write(s,c))}return o}if(t instanceof Uint8Array&&(a.isBlobSchema()||a.isDocumentSchema()))return a===this.rootSchema?t:(this.serdeContext?.base64Encoder??Tg)(t);if(t instanceof Date&&(a.isTimestampSchema()||a.isDocumentSchema()))switch(EP(a,this.settings)){case 5:return t.toISOString().replace(".000Z","Z");case 6:return M$(t);case 7:return t.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",t),t.getTime()/1e3}t instanceof as&&(this.useReplacer=!0)}if(!(t===null&&n?.isStructSchema())){if(a.isStringSchema()){if(typeof t>"u"&&a.isIdempotencyToken())return Mz();const s=a.getMergedTraits().mediaType;return t!=null&&s&&(s==="application/json"||s.endsWith("+json"))?yo.from(t):t}if(typeof t=="number"&&a.isNumericSchema())return Math.abs(t)===1/0||isNaN(t)?String(t):t;if(typeof t=="string"&&a.isBlobSchema())return a===this.rootSchema?t:(this.serdeContext?.base64Encoder??Tg)(t);if(typeof t=="bigint"&&(this.useReplacer=!0),a.isDocumentSchema())if(i){const s=Array.isArray(t)?[]:{};for(const o in t){const l=t[o];l instanceof as?(this.useReplacer=!0,s[o]=l):s[o]=this._write(a,l)}return s}else return structuredClone(t);return t}}}class Dj extends sb{settings;constructor(e){super(),this.settings=e}createSerializer(){const e=new Pj(this.settings);return e.setSerdeContext(this.serdeContext),e}createDeserializer(){const e=new Fj(this.settings);return e.setSerdeContext(this.serdeContext),e}}class Rj extends Lz{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a}){super({defaultNamespace:e,errorTypeRegistries:t}),this.serviceTarget=n,this.codec=a??new Dj({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!i,this.mixin=new wj(this.awsQueryCompatible)}async serializeRequest(e,t,n){const i=await super.serializeRequest(e,t,n);return i.path.endsWith("/")||(i.path+="/"),i.headers["content-type"]=`application/x-amz-json-${this.getJsonRpcVersion()}`,i.headers["x-amz-target"]=`${this.serviceTarget}.${e.name}`,this.awsQueryCompatible&&(i.headers["x-amzn-query-mode"]="true"),(tg(e.input)==="unit"||!i.body)&&(i.body="{}"),i}getPayloadCodec(){return this.codec}async handleError(e,t,n,i,a){const{awsQueryCompatible:s}=this;s&&this.mixin.setQueryCompatError(i,n);const o=kj(n,i,s)??"Unknown";this.mixin.compose(this.compositeErrorRegistry,o,this.options.defaultNamespace);const{errorSchema:l,errorMetadata:u}=await this.mixin.getErrorSchemaOrThrowBaseException(o,this.options.defaultNamespace,n,i,a,s?this.mixin.findQueryCompatibleError:void 0),c=yi.of(l),f=i.message??i.Message??"UnknownError",d=this.compositeErrorRegistry.getErrorCtor(l)??Error,h=new d({}),g={},y=this.codec.createDeserializer();for(const[v,A]of c.structIterator())i[v]!=null&&(g[v]=y.readObject(A,i[v]));throw s&&this.mixin.queryCompatOutput(i,g),this.mixin.decorateServiceException(Object.assign(h,u,{$fault:c.getMergedTraits().error,message:f},g),i)}}class Oj extends Rj{constructor({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a}){super({defaultNamespace:e,errorTypeRegistries:t,serviceTarget:n,awsQueryCompatible:i,jsonCodec:a})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}const Rf="ref",yl=-1,Rp=!0,w2="isSet",$P="PartitionResult",Op="booleanEquals",nv="getAttr",Pd="stringEquals",x2={[Rf]:"Endpoint"},iv={[Rf]:$P},qd={[Rf]:"Region"},Ja={},C2=[qd],S2={conditions:[[w2,[x2]],[w2,C2],["aws.partition",C2,$P],[Op,[{[Rf]:"UseFIPS"},Rp]],[Op,[{fn:nv,argv:[iv,"supportsFIPS"]},Rp]],[Op,[{[Rf]:"UseDualStack"},Rp]],[Op,[{fn:nv,argv:[iv,"supportsDualStack"]},Rp]],[Pd,[{fn:nv,argv:[iv,"name"]},"aws"]],[Pd,[qd,"us-east-1"]],[Pd,[qd,"us-east-2"]],[Pd,[qd,"us-west-1"]],[Pd,[qd,"us-west-2"]]],results:[[yl],[yl,"Invalid Configuration: FIPS and custom endpoint are not supported"],[yl,"Invalid Configuration: Dualstack and custom endpoint are not supported"],[x2,Ja],["https://cognito-idp-fips.us-east-1.amazonaws.com",Ja],["https://cognito-idp-fips.us-east-2.amazonaws.com",Ja],["https://cognito-idp-fips.us-west-1.amazonaws.com",Ja],["https://cognito-idp-fips.us-west-2.amazonaws.com",Ja],["https://cognito-idp-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",Ja],[yl,"FIPS and DualStack are enabled, but this partition does not support one or both"],["https://cognito-idp-fips.{Region}.{PartitionResult#dnsSuffix}",Ja],[yl,"FIPS is enabled but this partition does not support FIPS"],["https://cognito-idp.{Region}.amazonaws.com",Ja],["https://cognito-idp.{Region}.{PartitionResult#dualStackDnsSuffix}",Ja],[yl,"DualStack is enabled but this partition does not support DualStack"],["https://cognito-idp.{Region}.{PartitionResult#dnsSuffix}",Ja],[yl,"Invalid Configuration: Missing Region"]]},Bj=2,pi=1e8,Mj=new Int32Array([-1,1,-1,0,17,3,1,4,pi+16,2,5,pi+16,3,9,6,5,7,pi+15,6,8,pi+14,7,pi+12,pi+13,4,11,10,5,pi+9,pi+11,5,12,pi+10,6,13,pi+9,8,pi+4,14,9,pi+5,15,10,pi+6,16,11,pi+7,pi+8,3,pi+1,18,5,pi+2,pi+3]),_j=eb.from(Mj,Bj,S2.conditions,S2.results),Nj=new hz({size:50,params:["Endpoint","Region","UseDualStack","UseFIPS"]}),Lj=(r,e={})=>Nj.get(r,()=>Rz(_j,{endpointParams:r,logger:e.logger}));tb.aws=PP;class xt extends $u{constructor(e){super(e),Object.setPrototypeOf(this,xt.prototype)}}class ob extends xt{name="AccessDeniedException";$fault="client";constructor(e){super({name:"AccessDeniedException",$fault:"client",...e}),Object.setPrototypeOf(this,ob.prototype)}}class lb extends xt{name="InternalErrorException";$fault="server";constructor(e){super({name:"InternalErrorException",$fault:"server",...e}),Object.setPrototypeOf(this,lb.prototype)}}class ub extends xt{name="InvalidParameterException";$fault="client";reasonCode;constructor(e){super({name:"InvalidParameterException",$fault:"client",...e}),Object.setPrototypeOf(this,ub.prototype),this.reasonCode=e.reasonCode}}class cb extends xt{name="NotAuthorizedException";$fault="client";constructor(e){super({name:"NotAuthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,cb.prototype)}}class db extends xt{name="OperationNotEnabledException";$fault="client";constructor(e){super({name:"OperationNotEnabledException",$fault:"client",...e}),Object.setPrototypeOf(this,db.prototype)}}class fb extends xt{name="ResourceNotFoundException";$fault="client";constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,fb.prototype)}}class hb extends xt{name="TooManyRequestsException";$fault="client";constructor(e){super({name:"TooManyRequestsException",$fault:"client",...e}),Object.setPrototypeOf(this,hb.prototype)}}class pb extends xt{name="UserImportInProgressException";$fault="client";constructor(e){super({name:"UserImportInProgressException",$fault:"client",...e}),Object.setPrototypeOf(this,pb.prototype)}}class gb extends xt{name="InternalServerException";$fault="server";constructor(e){super({name:"InternalServerException",$fault:"server",...e}),Object.setPrototypeOf(this,gb.prototype)}}class mb extends xt{name="LimitExceededException";$fault="client";constructor(e){super({name:"LimitExceededException",$fault:"client",...e}),Object.setPrototypeOf(this,mb.prototype)}}class yb extends xt{name="UserNotFoundException";$fault="client";constructor(e){super({name:"UserNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,yb.prototype)}}class vb extends xt{name="InvalidLambdaResponseException";$fault="client";constructor(e){super({name:"InvalidLambdaResponseException",$fault:"client",...e}),Object.setPrototypeOf(this,vb.prototype)}}class Ab extends xt{name="TooManyFailedAttemptsException";$fault="client";constructor(e){super({name:"TooManyFailedAttemptsException",$fault:"client",...e}),Object.setPrototypeOf(this,Ab.prototype)}}class bb extends xt{name="UnexpectedLambdaException";$fault="client";constructor(e){super({name:"UnexpectedLambdaException",$fault:"client",...e}),Object.setPrototypeOf(this,bb.prototype)}}class wb extends xt{name="UserLambdaValidationException";$fault="client";constructor(e){super({name:"UserLambdaValidationException",$fault:"client",...e}),Object.setPrototypeOf(this,wb.prototype)}}class xb extends xt{name="CodeDeliveryFailureException";$fault="client";constructor(e){super({name:"CodeDeliveryFailureException",$fault:"client",...e}),Object.setPrototypeOf(this,xb.prototype)}}class Cb extends xt{name="InvalidPasswordException";$fault="client";constructor(e){super({name:"InvalidPasswordException",$fault:"client",...e}),Object.setPrototypeOf(this,Cb.prototype)}}class Sb extends xt{name="InvalidSmsRoleAccessPolicyException";$fault="client";constructor(e){super({name:"InvalidSmsRoleAccessPolicyException",$fault:"client",...e}),Object.setPrototypeOf(this,Sb.prototype)}}class Eb extends xt{name="InvalidSmsRoleTrustRelationshipException";$fault="client";constructor(e){super({name:"InvalidSmsRoleTrustRelationshipException",$fault:"client",...e}),Object.setPrototypeOf(this,Eb.prototype)}}class kb extends xt{name="PreconditionNotMetException";$fault="client";constructor(e){super({name:"PreconditionNotMetException",$fault:"client",...e}),Object.setPrototypeOf(this,kb.prototype)}}class Tb extends xt{name="UnsupportedUserStateException";$fault="client";constructor(e){super({name:"UnsupportedUserStateException",$fault:"client",...e}),Object.setPrototypeOf(this,Tb.prototype)}}class Fb extends xt{name="UsernameExistsException";$fault="client";constructor(e){super({name:"UsernameExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Fb.prototype)}}class Ib extends xt{name="AliasExistsException";$fault="client";constructor(e){super({name:"AliasExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Ib.prototype)}}class Pb extends xt{name="InvalidUserPoolConfigurationException";$fault="client";constructor(e){super({name:"InvalidUserPoolConfigurationException",$fault:"client",...e}),Object.setPrototypeOf(this,Pb.prototype)}}class Db extends xt{name="InvalidEmailRoleAccessPolicyException";$fault="client";constructor(e){super({name:"InvalidEmailRoleAccessPolicyException",$fault:"client",...e}),Object.setPrototypeOf(this,Db.prototype)}}class Rb extends xt{name="MFAMethodNotFoundException";$fault="client";constructor(e){super({name:"MFAMethodNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,Rb.prototype)}}class Ob extends xt{name="PasswordResetRequiredException";$fault="client";constructor(e){super({name:"PasswordResetRequiredException",$fault:"client",...e}),Object.setPrototypeOf(this,Ob.prototype)}}class Bb extends xt{name="UnsupportedOperationException";$fault="client";constructor(e){super({name:"UnsupportedOperationException",$fault:"client",...e}),Object.setPrototypeOf(this,Bb.prototype)}}class Mb extends xt{name="UserNotConfirmedException";$fault="client";constructor(e){super({name:"UserNotConfirmedException",$fault:"client",...e}),Object.setPrototypeOf(this,Mb.prototype)}}class _b extends xt{name="UserPoolAddOnNotEnabledException";$fault="client";constructor(e){super({name:"UserPoolAddOnNotEnabledException",$fault:"client",...e}),Object.setPrototypeOf(this,_b.prototype)}}class Nb extends xt{name="CodeMismatchException";$fault="client";constructor(e){super({name:"CodeMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,Nb.prototype)}}class Lb extends xt{name="ExpiredCodeException";$fault="client";constructor(e){super({name:"ExpiredCodeException",$fault:"client",...e}),Object.setPrototypeOf(this,Lb.prototype)}}class Ub extends xt{name="PasswordHistoryPolicyViolationException";$fault="client";constructor(e){super({name:"PasswordHistoryPolicyViolationException",$fault:"client",...e}),Object.setPrototypeOf(this,Ub.prototype)}}class Vb extends xt{name="SoftwareTokenMFANotFoundException";$fault="client";constructor(e){super({name:"SoftwareTokenMFANotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,Vb.prototype)}}class $b extends xt{name="ConcurrentModificationException";$fault="client";constructor(e){super({name:"ConcurrentModificationException",$fault:"client",...e}),Object.setPrototypeOf(this,$b.prototype)}}class zb extends xt{name="ForbiddenException";$fault="client";constructor(e){super({name:"ForbiddenException",$fault:"client",...e}),Object.setPrototypeOf(this,zb.prototype)}}class Hb extends xt{name="WebAuthnChallengeNotFoundException";$fault="client";constructor(e){super({name:"WebAuthnChallengeNotFoundException",$fault:"client",...e}),Object.setPrototypeOf(this,Hb.prototype)}}class Gb extends xt{name="WebAuthnClientMismatchException";$fault="client";constructor(e){super({name:"WebAuthnClientMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,Gb.prototype)}}class jb extends xt{name="WebAuthnCredentialNotSupportedException";$fault="client";constructor(e){super({name:"WebAuthnCredentialNotSupportedException",$fault:"client",...e}),Object.setPrototypeOf(this,jb.prototype)}}class qb extends xt{name="WebAuthnNotEnabledException";$fault="client";constructor(e){super({name:"WebAuthnNotEnabledException",$fault:"client",...e}),Object.setPrototypeOf(this,qb.prototype)}}class Wb extends xt{name="WebAuthnOriginNotAllowedException";$fault="client";constructor(e){super({name:"WebAuthnOriginNotAllowedException",$fault:"client",...e}),Object.setPrototypeOf(this,Wb.prototype)}}class Qb extends xt{name="WebAuthnRelyingPartyMismatchException";$fault="client";constructor(e){super({name:"WebAuthnRelyingPartyMismatchException",$fault:"client",...e}),Object.setPrototypeOf(this,Qb.prototype)}}class Yb extends xt{name="DeviceKeyExistsException";$fault="client";constructor(e){super({name:"DeviceKeyExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Yb.prototype)}}class Xb extends xt{name="GroupExistsException";$fault="client";constructor(e){super({name:"GroupExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Xb.prototype)}}class Jb extends xt{name="DuplicateProviderException";$fault="client";constructor(e){super({name:"DuplicateProviderException",$fault:"client",...e}),Object.setPrototypeOf(this,Jb.prototype)}}class Kb extends xt{name="ManagedLoginBrandingExistsException";$fault="client";constructor(e){super({name:"ManagedLoginBrandingExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Kb.prototype)}}class Zb extends xt{name="TermsExistsException";$fault="client";constructor(e){super({name:"TermsExistsException",$fault:"client",...e}),Object.setPrototypeOf(this,Zb.prototype)}}class ew extends xt{name="FeatureUnavailableInTierException";$fault="client";constructor(e){super({name:"FeatureUnavailableInTierException",$fault:"client",...e}),Object.setPrototypeOf(this,ew.prototype)}}class tw extends xt{name="TierChangeNotAllowedException";$fault="client";constructor(e){super({name:"TierChangeNotAllowedException",$fault:"client",...e}),Object.setPrototypeOf(this,tw.prototype)}}class rw extends xt{name="UserPoolTaggingException";$fault="client";constructor(e){super({name:"UserPoolTaggingException",$fault:"client",...e}),Object.setPrototypeOf(this,rw.prototype)}}class nw extends xt{name="InvalidOAuthFlowException";$fault="client";constructor(e){super({name:"InvalidOAuthFlowException",$fault:"client",...e}),Object.setPrototypeOf(this,nw.prototype)}}class iw extends xt{name="ScopeDoesNotExistException";$fault="client";constructor(e){super({name:"ScopeDoesNotExistException",$fault:"client",...e}),Object.setPrototypeOf(this,iw.prototype)}}class aw extends xt{name="UnsupportedIdentityProviderException";$fault="client";constructor(e){super({name:"UnsupportedIdentityProviderException",$fault:"client",...e}),Object.setPrototypeOf(this,aw.prototype)}}class sw extends xt{name="RefreshTokenReuseException";$fault="client";constructor(e){super({name:"RefreshTokenReuseException",$fault:"client",...e}),Object.setPrototypeOf(this,sw.prototype)}}class ow extends xt{name="UnauthorizedException";$fault="client";constructor(e){super({name:"UnauthorizedException",$fault:"client",...e}),Object.setPrototypeOf(this,ow.prototype)}}class lw extends xt{name="UnsupportedTokenTypeException";$fault="client";constructor(e){super({name:"UnsupportedTokenTypeException",$fault:"client",...e}),Object.setPrototypeOf(this,lw.prototype)}}class uw extends xt{name="WebAuthnConfigurationMissingException";$fault="client";constructor(e){super({name:"WebAuthnConfigurationMissingException",$fault:"client",...e}),Object.setPrototypeOf(this,uw.prototype)}}class cw extends xt{name="EnableSoftwareTokenMFAException";$fault="client";constructor(e){super({name:"EnableSoftwareTokenMFAException",$fault:"client",...e}),Object.setPrototypeOf(this,cw.prototype)}}const Uj="AvailableChallenges",Vj="AccessDeniedException",$j="AliasExistsException",zj="AnalyticsEndpointId",Hj="AuthFlow",zP="AnalyticsMetadata",Gj="AnalyticsMetadataType",jj="AuthParameters",qj="AuthParametersType",HP="AuthenticationResult",Wj="AuthenticationResultType",Qj="AccessToken",Yj="CodeDeliveryFailureException",GP="ClientId",Xj="ClientIdType",jP="ClientMetadata",Jj="CodeMismatchException",Kj="ConcurrentModificationException",dw="ChallengeName",qP="ChallengeParameters",Zj="ChallengeResponses",eq="ChallengeResponsesType",tq="DeviceGroupKey",rq="DeviceKey",nq="DeviceKeyExistsException",iq="DuplicateProviderException",aq="ExpiredCodeException",sq="EncodedData",oq="ExpiresIn",lq="EnableSoftwareTokenMFAException",uq="ForbiddenException",cq="FeatureUnavailableInTierException",dq="GroupExistsException",fq="IpAddress",hq="InitiateAuthRequest",pq="InitiateAuthResponse",gq="InitiateAuth",mq="InternalErrorException",yq="InvalidEmailRoleAccessPolicyException",vq="InvalidLambdaResponseException",Aq="InvalidOAuthFlowException",bq="InvalidParameterException",wq="InvalidPasswordException",xq="InternalServerException",Cq="InvalidSmsRoleAccessPolicyException",Sq="InvalidSmsRoleTrustRelationshipException",Eq="IdToken",kq="InvalidUserPoolConfigurationException",Tq="LimitExceededException",Fq="MFAMethodNotFoundException",Iq="ManagedLoginBrandingExistsException",Pq="NotAuthorizedException",Dq="NewDeviceMetadata",Rq="NewDeviceMetadataType",Oq="OperationNotEnabledException",Bq="PasswordHistoryPolicyViolationException",Mq="PreconditionNotMetException",_q="PasswordResetRequiredException",Nq="ResourceNotFoundException",Lq="RefreshToken",Uq="RespondToAuthChallenge",Vq="RespondToAuthChallengeRequest",$q="RespondToAuthChallengeResponse",zq="RefreshTokenReuseException",lm="Session",Hq="ScopeDoesNotExistException",Gq="SessionType",jq="SoftwareTokenMFANotFoundException",qq="TierChangeNotAllowedException",Wq="TermsExistsException",Qq="TooManyFailedAttemptsException",Yq="TooManyRequestsException",Xq="TokenModelType",Jq="TokenType",Kq="UserContextDataType",WP="UserContextData",Zq="UnauthorizedException",eW="UsernameExistsException",tW="UserImportInProgressException",rW="UnsupportedIdentityProviderException",nW="UnexpectedLambdaException",iW="UserLambdaValidationException",aW="UserNotConfirmedException",sW="UserNotFoundException",oW="UnsupportedOperationException",lW="UserPoolAddOnNotEnabledException",uW="UserPoolTaggingException",cW="UnsupportedTokenTypeException",dW="UnsupportedUserStateException",fW="WebAuthnClientMismatchException",hW="WebAuthnConfigurationMissingException",pW="WebAuthnChallengeNotFoundException",gW="WebAuthnCredentialNotSupportedException",mW="WebAuthnNotEnabledException",yW="WebAuthnOriginNotAllowedException",vW="WebAuthnRelyingPartyMismatchException",It="client",Tt="error",Pt="httpError",Ft="message",AW="reasonCode",QP="smithy.ts.sdk.synthetic.com.amazonaws.cognitoidentityprovider",YP="server",at="com.amazonaws.cognitoidentityprovider",XP=ta.for(QP);var bW=[-3,QP,"CognitoIdentityProviderServiceException",0,[],[]];XP.registerError(bW,xt);const kt=ta.for(at);var wW=[-3,at,Vj,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(wW,ob);var xW=[-3,at,$j,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(xW,Ib);var CW=[-3,at,Yj,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(CW,xb);var SW=[-3,at,Jj,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(SW,Nb);var EW=[-3,at,Kj,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(EW,$b);var kW=[-3,at,nq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(kW,Yb);var TW=[-3,at,iq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(TW,Jb);var FW=[-3,at,lq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(FW,cw);var IW=[-3,at,aq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(IW,Lb);var PW=[-3,at,cq,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(PW,ew);var DW=[-3,at,uq,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(DW,zb);var RW=[-3,at,dq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(RW,Xb);var OW=[-3,at,mq,{[Tt]:YP},[Ft],[0]];kt.registerError(OW,lb);var BW=[-3,at,xq,{[Tt]:YP},[Ft],[0]];kt.registerError(BW,gb);var MW=[-3,at,yq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(MW,Db);var _W=[-3,at,vq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(_W,vb);var NW=[-3,at,Aq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(NW,nw);var LW=[-3,at,bq,{[Tt]:It,[Pt]:400},[Ft,AW],[0,0]];kt.registerError(LW,ub);var UW=[-3,at,wq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(UW,Cb);var VW=[-3,at,Cq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(VW,Sb);var $W=[-3,at,Sq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError($W,Eb);var zW=[-3,at,kq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(zW,Pb);var HW=[-3,at,Tq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(HW,mb);var GW=[-3,at,Iq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(GW,Kb);var jW=[-3,at,Fq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(jW,Rb);var qW=[-3,at,Pq,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(qW,cb);var WW=[-3,at,Oq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(WW,db);var QW=[-3,at,Bq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(QW,Ub);var YW=[-3,at,_q,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(YW,Ob);var XW=[-3,at,Mq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(XW,kb);var JW=[-3,at,zq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(JW,sw);var KW=[-3,at,Nq,{[Tt]:It,[Pt]:404},[Ft],[0]];kt.registerError(KW,fb);var ZW=[-3,at,Hq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(ZW,iw);var eQ=[-3,at,jq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(eQ,Vb);var tQ=[-3,at,Wq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(tQ,Zb);var rQ=[-3,at,qq,{[Tt]:It,[Pt]:403},[Ft],[0]];kt.registerError(rQ,tw);var nQ=[-3,at,Qq,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(nQ,Ab);var iQ=[-3,at,Yq,{[Tt]:It,[Pt]:429},[Ft],[0]];kt.registerError(iQ,hb);var aQ=[-3,at,Zq,{[Tt]:It,[Pt]:401},[Ft],[0]];kt.registerError(aQ,ow);var sQ=[-3,at,nW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(sQ,bb);var oQ=[-3,at,rW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(oQ,aw);var lQ=[-3,at,oW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(lQ,Bb);var uQ=[-3,at,cW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(uQ,lw);var cQ=[-3,at,dW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(cQ,Tb);var dQ=[-3,at,tW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(dQ,pb);var fQ=[-3,at,iW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(fQ,wb);var hQ=[-3,at,eW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(hQ,Fb);var pQ=[-3,at,aW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(pQ,Mb);var gQ=[-3,at,sW,{[Tt]:It,[Pt]:404},[Ft],[0]];kt.registerError(gQ,yb);var mQ=[-3,at,lW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(mQ,_b);var yQ=[-3,at,uW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(yQ,rw);var vQ=[-3,at,pW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(vQ,Hb);var AQ=[-3,at,fW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(AQ,Gb);var bQ=[-3,at,hW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(bQ,uw);var wQ=[-3,at,gW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(wQ,jb);var xQ=[-3,at,mW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(xQ,qb);var CQ=[-3,at,yW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(CQ,Wb);var SQ=[-3,at,vW,{[Tt]:It,[Pt]:400},[Ft],[0]];kt.registerError(SQ,Qb);const EQ=[XP,kt];var JP=[0,at,Xj,8,0],um=[0,at,Gq,8,0],av=[0,at,Xq,8,0],KP=[3,at,Gj,0,[zj],[0]],ZP=[3,at,Wj,0,[Qj,oq,Jq,Lq,Eq,Dq],[[()=>av,0],1,0,[()=>av,0],[()=>av,0],()=>FQ]],kQ=[3,at,hq,0,[Hj,GP,jj,jP,zP,WP,lm],[0,[()=>JP,0],[()=>DQ,0],128,()=>KP,[()=>eD,0],[()=>um,0]],2],TQ=[3,at,pq,0,[dw,lm,qP,HP,Uj],[0,[()=>um,0],128,[()=>ZP,0],64]],FQ=[3,at,Rq,0,[rq,tq],[0,0]],IQ=[3,at,Vq,0,[GP,dw,lm,Zj,zP,WP,jP],[[()=>JP,0],0,[()=>um,0],[()=>RQ,0],()=>KP,[()=>eD,0],128],2],PQ=[3,at,$q,0,[dw,lm,qP,HP],[0,[()=>um,0],128,[()=>ZP,0]]],eD=[3,at,Kq,8,[fq,sq],[0,0]],DQ=[2,at,qj,8,0,0],RQ=[2,at,eq,8,0,0],OQ=[9,at,gq,0,()=>kQ,()=>TQ],BQ=[9,at,Uq,0,()=>IQ,()=>PQ];const MQ=r=>({apiVersion:"2016-04-18",base64Decoder:r?.base64Decoder??im,base64Encoder:r?.base64Encoder??Tg,disableHostPrefix:r?.disableHostPrefix??!1,endpointProvider:r?.endpointProvider??Lj,extensions:r?.extensions??[],httpAuthSchemeProvider:r?.httpAuthSchemeProvider??YG,httpAuthSchemes:r?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:e=>e.getIdentityProvider("aws.auth#sigv4"),signer:new AG},{schemeId:"smithy.api#noAuth",identityProvider:e=>e.getIdentityProvider("smithy.api#noAuth")||(async()=>({})),signer:new NH}],logger:r?.logger??new lP,protocol:r?.protocol??Oj,protocolSettings:r?.protocolSettings??{defaultNamespace:"com.amazonaws.cognitoidentityprovider",errorTypeRegistries:EQ,xmlNamespace:"http://cognito-idp.amazonaws.com/doc/2016-04-18/",version:"2016-04-18",serviceTarget:"AWSCognitoIdentityProviderService"},serviceId:r?.serviceId??"Cognito Identity Provider",urlParser:r?.urlParser??kg,utf8Decoder:r?.utf8Decoder??Pl,utf8Encoder:r?.utf8Encoder??am}),_Q=r=>{const e=dG(r),t=()=>e().then(p$),n=MQ(r);return{...n,...r,runtime:"browser",defaultsMode:e,bodyLengthChecker:r?.bodyLengthChecker??X$,credentialDefaultProvider:r?.credentialDefaultProvider??(i=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:r?.defaultUserAgentProvider??nG({serviceId:n.serviceId,clientVersion:ZG.version}),maxAttempts:r?.maxAttempts??nf,region:r?.region??a$("Region is missing"),requestHandler:ab.create(r?.requestHandler??t),retryMode:r?.retryMode??(async()=>(await t()).retryMode||gH),sha256:r?.sha256??gj,streamCollector:r?.streamCollector??yj,useDualstackEndpoint:r?.useDualstackEndpoint??(()=>Promise.resolve(hG)),useFipsEndpoint:r?.useFipsEndpoint??(()=>Promise.resolve(pG))}},NQ=r=>{const e=r.httpAuthSchemes;let t=r.httpAuthSchemeProvider,n=r.credentials;return{setHttpAuthScheme(i){const a=e.findIndex(s=>s.schemeId===i.schemeId);a===-1?e.push(i):e.splice(a,1,i)},httpAuthSchemes(){return e},setHttpAuthSchemeProvider(i){t=i},httpAuthSchemeProvider(){return t},setCredentials(i){n=i},credentials(){return n}}},LQ=r=>({httpAuthSchemes:r.httpAuthSchemes(),httpAuthSchemeProvider:r.httpAuthSchemeProvider(),credentials:r.credentials()}),UQ=(r,e)=>{const t=Object.assign(gG(r),A$(r),Uz(r),NQ(r));return e.forEach(n=>n.configure(t)),Object.assign(r,mG(t),b$(t),Vz(t),LQ(t))};class VQ extends s${config;constructor(...[e]){const t=_Q(e||{});super(t),this.initConfig=t;const n=JG(t),i=GH(n),a=yH(i),s=uG(a),o=s,l=Oz(o),u=XG(l),c=UQ(u,e?.extensions||[]);this.config=c,this.middlewareStack.use(d$(this.config)),this.middlewareStack.use(rG(this.config)),this.middlewareStack.use(vH(this.config)),this.middlewareStack.use(Hz(this.config)),this.middlewareStack.use(wH(this.config)),this.middlewareStack.use(SH(this.config)),this.middlewareStack.use(EH(this.config)),this.middlewareStack.use(PH(this.config,{httpAuthSchemeParametersProvider:WG,identityProviderConfigProvider:async f=>new _H({"aws.auth#sigv4":f.credentials})})),this.middlewareStack.use(MH(this.config))}destroy(){super.destroy()}}class E2 extends K1.classBuilder().ep(UP).m(function(e,t,n,i){return[CP(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","InitiateAuth",{}).n("CognitoIdentityProviderClient","InitiateAuthCommand").sc(OQ).build(){}class $Q extends K1.classBuilder().ep(UP).m(function(e,t,n,i){return[CP(n,e.getEndpointParameterInstructions())]}).s("AWSCognitoIdentityProviderService","RespondToAuthChallenge",{}).n("CognitoIdentityProviderClient","RespondToAuthChallengeCommand").sc(BQ).build(){}class zQ{init(e,t,n){this.cognitoClient=new VQ({region:t}),this.spiffRegion=e,this.userPoolClientId=n}async generateCode(e){const t=await this.cognitoClient?.send(new E2({AuthFlow:"CUSTOM_AUTH",ClientId:this.userPoolClientId,AuthParameters:{USERNAME:e}}));t?.ChallengeName==="CUSTOM_CHALLENGE"&&(this.challengeSession=t.Session)}async verifyCode(e,t,n){const i=await this.cognitoClient?.send(new $Q({ClientId:this.userPoolClientId,ChallengeName:"CUSTOM_CHALLENGE",Session:this.challengeSession,ChallengeResponses:{USERNAME:e,ANSWER:t},ClientMetadata:{partnerId:n,environment:(this.spiffRegion||"").toLowerCase()}}));return i?.ChallengeName==="CUSTOM_CHALLENGE"&&(this.challengeSession=i.Session),i}async refreshTokens(){const e=localStorage.getItem("cognito-tokens");if(!e)throw new Error("Failed to find existing tokens.");const t=JSON.parse(e);return await this.cognitoClient?.send(new E2({AuthFlow:"REFRESH_TOKEN_AUTH",ClientId:this.userPoolClientId,AuthParameters:{REFRESH_TOKEN:t.RefreshToken||""}}))}}const Dd=new zQ;var HQ={defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},GQ={globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}};function of(r){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?of=function(e){return typeof e}:of=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},of(r)}function k2(r){return jQ(r)||qQ(r)||WQ(r)||QQ()}function jQ(r){if(Array.isArray(r))return r}function qQ(r){if(typeof Symbol<"u"&&Symbol.iterator in Object(r))return Array.from(r)}function WQ(r,e){if(r){if(typeof r=="string")return T2(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return T2(r,e)}}function T2(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function QQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3065
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var YQ={normalizePrecision:function(e){var t=e.reduce(function(n,i){return Math.max(n.getPrecision(),i.getPrecision())});return e.map(function(n){return n.getPrecision()!==t?n.convertPrecision(t):n})},minimum:function(e){var t=k2(e),n=t[0],i=t.slice(1),a=n;return i.forEach(function(s){a=a.lessThan(s)?a:s}),a},maximum:function(e){var t=k2(e),n=t[0],i=t.slice(1),a=n;return i.forEach(function(s){a=a.greaterThan(s)?a:s}),a}};function tD(r){return!isNaN(parseInt(r))&&isFinite(r)}function XQ(r){return tD(r)&&r<=100&&r>=0}function JQ(r){return r.length>0&&r.every(function(e){return e>=0})&&r.some(function(e){return e>0})}function F2(r){return r%2===0}function I2(r){return tD(r)&&!Number.isInteger(r)}function KQ(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=r.toString();if(e.indexOf("e-")>0)return parseInt(e.split("e-")[1]);var t=e.split(".")[1];return t?t.length:0}function Rd(r){return Math.abs(r)%1===.5}function ZQ(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return new Promise(function(t,n){var i=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){i.readyState===4&&(i.status>=200&&i.status<400?t(JSON.parse(i.responseText)):n(new Error(i.statusText)))},onerror:function(){n(new Error("Network error"))}});i.open("GET",r,!0),eY(i,e.headers),i.send()})}function eY(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};for(var t in e)r.setRequestHeader(t,e[t]);return r}function Wd(r){return typeof r>"u"}function rD(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:".",t={};return Object.entries(r).forEach(function(n){if(of(n[1])==="object"){var i=rD(n[1]);Object.entries(i).forEach(function(a){t[n[0]+e+a[0]]=a[1]})}else t[n[0]]=n[1]}),t}function tY(r){return!!r&&(of(r)==="object"||typeof r=="function")&&typeof r.then=="function"}function nD(){var r=function(n,i){var a=function(l){return Math.pow(10,KQ(l))},s=Math.max(a(n),a(i));return Math.round(n*s)*Math.round(i*s)/(s*s)},e={HALF_ODD:function(n){var i=Math.round(n);return Rd(n)&&F2(i)?i-1:i},HALF_EVEN:function(n){var i=Math.round(n);return Rd(n)?F2(i)?i:i-1:i},HALF_UP:function(n){return Math.round(n)},HALF_DOWN:function(n){return Rd(n)?Math.floor(n):Math.round(n)},HALF_TOWARDS_ZERO:function(n){return Rd(n)?Math.sign(n)*Math.floor(Math.abs(n)):Math.round(n)},HALF_AWAY_FROM_ZERO:function(n){return Rd(n)?Math.sign(n)*Math.ceil(Math.abs(n)):Math.round(n)},DOWN:function(n){return Math.floor(n)}};return{add:function(n,i){return n+i},subtract:function(n,i){return n-i},multiply:function(n,i){return I2(n)||I2(i)?r(n,i):n*i},divide:function(n,i){return n/i},modulo:function(n,i){return n%i},round:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"HALF_EVEN";return e[i](n)}}}var rY=nD();function nY(r){var e=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(r);return{getMatches:function(){return e!==null?e.slice(1).filter(function(n){return!Wd(n)}):[]},getMinimumFractionDigits:function(){var n=function(a){return a==="."};return Wd(this.getMatches().find(n))?0:this.getMatches()[rY.add(this.getMatches().findIndex(n),1)].split("").length},getCurrencyDisplay:function(){var n={USD:"code",dollar:"name",$:"symbol"};return n[this.getMatches().find(function(i){return i==="USD"||i==="dollar"||i==="$"})]},getStyle:function(){return Wd(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!Wd(this.getMatches().find(function(n){return n===","}))}}}function iY(r){var e=function(){var i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;for(var s in a)i=i.replace("{{".concat(s,"}}"),a[s]);return i},t=function(i,a){return ZQ(e(r.endpoint,{from:i,to:a}),{headers:r.headers})};return{getExchangeRate:function(i,a){return(tY(r.endpoint)?r.endpoint:t(i,a)).then(function(s){return rD(s)[e(r.propertyPath,{from:i,to:a})]})}}}function Of(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Error;if(!r)throw new t(e)}function aY(r){Of(XQ(r),"You must provide a numeric value between 0 and 100.",RangeError)}function sY(r){Of(JQ(r),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}function sv(r){Of(Number.isInteger(r),"You must provide an integer.",TypeError)}var Tn=nD(),oY=function r(e){var t=Object.assign({},{amount:r.defaultAmount,currency:r.defaultCurrency,precision:r.defaultPrecision},e),n=t.amount,i=t.currency,a=t.precision;sv(n),sv(a);var s=r.globalLocale,o=r.globalFormat,l=r.globalRoundingMode,u=r.globalFormatRoundingMode,c=Object.assign({},r.globalExchangeRatesApi),f=function(g){var y=Object.assign({},Object.assign({},{amount:n,currency:i,precision:a},g),Object.assign({},{locale:this.locale},g));return Object.assign(r({amount:y.amount,currency:y.currency,precision:y.precision}),{locale:y.locale})},d=function(g){Of(this.hasSameCurrency(g),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return n},getCurrency:function(){return i},getLocale:function(){return this.locale||s},setLocale:function(g){return f.call(this,{locale:g})},getPrecision:function(){return a},convertPrecision:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u;sv(g);var v=this.getPrecision(),A=g>v,x=A?Tn.multiply:Tn.divide,S=A?[g,v]:[v,g],F=Math.pow(10,Tn.subtract.apply(Tn,S));return f.call(this,{amount:Tn.round(x(this.getAmount(),F),y),precision:g})},add:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return f.call(this,{amount:Tn.add(y[0].getAmount(),y[1].getAmount()),precision:y[0].getPrecision()})},subtract:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return f.call(this,{amount:Tn.subtract(y[0].getAmount(),y[1].getAmount()),precision:y[0].getPrecision()})},multiply:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return f.call(this,{amount:Tn.round(Tn.multiply(this.getAmount(),g),y)})},divide:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return f.call(this,{amount:Tn.round(Tn.divide(this.getAmount(),g),y)})},percentage:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:l;return aY(g),this.multiply(Tn.divide(g,100),y)},allocate:function(g){var y=this;sY(g);for(var v=g.reduce(function(F,E){return Tn.add(F,E)}),A=this.getAmount(),x=g.map(function(F){var E=Math.floor(Tn.divide(Tn.multiply(y.getAmount(),F),v));return A=Tn.subtract(A,E),f.call(y,{amount:E})}),S=0;A>0;)g[S]>0&&(x[S]=x[S].add(f.call(this,{amount:1})),A=Tn.subtract(A,1)),S+=1;return x},convert:function(g){var y=this,v=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=v.endpoint,x=A===void 0?c.endpoint:A,S=v.propertyPath,F=S===void 0?c.propertyPath||"rates.{{to}}":S,E=v.headers,R=E===void 0?c.headers:E,O=v.roundingMode,W=O===void 0?l:O,Y=Object.assign({},{endpoint:x,propertyPath:F,headers:R,roundingMode:W});return iY(Y).getExchangeRate(this.getCurrency(),g).then(function(ae){return Of(!Wd(ae),'No rate was found for the destination currency "'.concat(g,'".'),TypeError),f.call(y,{amount:Tn.round(Tn.multiply(y.getAmount(),parseFloat(ae)),Y.roundingMode),currency:g})})},equalsTo:function(g){return this.hasSameAmount(g)&&this.hasSameCurrency(g)},lessThan:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return y[0].getAmount()<y[1].getAmount()},lessThanOrEqual:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return y[0].getAmount()<=y[1].getAmount()},greaterThan:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return y[0].getAmount()>y[1].getAmount()},greaterThanOrEqual:function(g){d.call(this,g);var y=r.normalizePrecision([this,g]);return y[0].getAmount()>=y[1].getAmount()},isZero:function(){return this.getAmount()===0},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return Tn.modulo(this.getAmount(),Math.pow(10,a))!==0},hasCents:function(){return Tn.modulo(this.getAmount(),Math.pow(10,a))!==0},hasSameCurrency:function(g){return this.getCurrency()===g.getCurrency()},hasSameAmount:function(g){var y=r.normalizePrecision([this,g]);return y[0].getAmount()===y[1].getAmount()},toFormat:function(){var g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:o,y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,v=nY(g);return this.toRoundedUnit(v.getMinimumFractionDigits(),y).toLocaleString(this.getLocale(),{currencyDisplay:v.getCurrencyDisplay(),useGrouping:v.getUseGrouping(),minimumFractionDigits:v.getMinimumFractionDigits(),style:v.getStyle(),currency:this.getCurrency()})},toUnit:function(){return Tn.divide(this.getAmount(),Math.pow(10,a))},toRoundedUnit:function(g){var y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:u,v=Math.pow(10,g);return Tn.divide(Tn.round(Tn.multiply(this.toUnit(),v),y),v)},toObject:function(){return{amount:n,currency:i,precision:a}},toJSON:function(){return this.toObject()}}},lY=Object.assign(oY,HQ,GQ,YQ),Ka={},ov,P2;function uY(){if(P2)return ov;P2=1;function r(t){return t}function e(t,a,s){for(var a=a||r,s=s||t,o=0,l=t.length;o<l;o+=1)if(a.call(s,t[o],o))return t[o]}return ov=e,ov}var lv={exports:{}},D2;function cY(){if(D2)return lv.exports;D2=1;var r=lv.exports=function(e,t){if(typeof e=="function"||t)return r.by(e,t);for(var n={object:[],function:[],string:{},number:{},boolean:{},undefined:{}},i=[],a=0;a<e.length;a++){var s=e[a],o=s==="__proto__"?n.objects:n[typeof s]||n.objects;Array.isArray(o)?o.indexOf(s)<0&&(o.push(s),i.push(s)):Object.hasOwnProperty.call(o,s)||(o[s]=!0,i.push(s))}return i};return r.by=function(e,t){if(typeof e=="function"){var n=t;t=e,e=n}for(var i=[],a=0;a<e.length;a++){for(var s=e[a],o=!1,l=0;l<i.length;l++){var u=i[l];if(t.call(i,s,u)){o=!0;break}}o||i.push(s)}return i},lv.exports}var uv,R2;function dY(){return R2||(R2=1,uv=[{code:"AED",number:"784",digits:2,currency:"UAE Dirham",countries:["United Arab Emirates (The)"]},{code:"AFN",number:"971",digits:2,currency:"Afghani",countries:["Afghanistan"]},{code:"ALL",number:"008",digits:2,currency:"Lek",countries:["Albania"]},{code:"AMD",number:"051",digits:2,currency:"Armenian Dram",countries:["Armenia"]},{code:"ANG",number:"532",digits:2,currency:"Netherlands Antillean Guilder",countries:["Curaçao","Sint Maarten (Dutch Part)"]},{code:"AOA",number:"973",digits:2,currency:"Kwanza",countries:["Angola"]},{code:"ARS",number:"032",digits:2,currency:"Argentine Peso",countries:["Argentina"]},{code:"AUD",number:"036",digits:2,currency:"Australian Dollar",countries:["Australia","Christmas Island","Cocos (Keeling) Islands (The)","Heard Island and Mcdonald Islands","Kiribati","Nauru","Norfolk Island","Tuvalu"]},{code:"AWG",number:"533",digits:2,currency:"Aruban Florin",countries:["Aruba"]},{code:"AZN",number:"944",digits:2,currency:"Azerbaijan Manat",countries:["Azerbaijan"]},{code:"BAM",number:"977",digits:2,currency:"Convertible Mark",countries:["Bosnia and Herzegovina"]},{code:"BBD",number:"052",digits:2,currency:"Barbados Dollar",countries:["Barbados"]},{code:"BDT",number:"050",digits:2,currency:"Taka",countries:["Bangladesh"]},{code:"BGN",number:"975",digits:2,currency:"Bulgarian Lev",countries:["Bulgaria"]},{code:"BHD",number:"048",digits:3,currency:"Bahraini Dinar",countries:["Bahrain"]},{code:"BIF",number:"108",digits:0,currency:"Burundi Franc",countries:["Burundi"]},{code:"BMD",number:"060",digits:2,currency:"Bermudian Dollar",countries:["Bermuda"]},{code:"BND",number:"096",digits:2,currency:"Brunei Dollar",countries:["Brunei Darussalam"]},{code:"BOB",number:"068",digits:2,currency:"Boliviano",countries:["Bolivia (Plurinational State Of)"]},{code:"BOV",number:"984",digits:2,currency:"Mvdol",countries:["Bolivia (Plurinational State Of)"]},{code:"BRL",number:"986",digits:2,currency:"Brazilian Real",countries:["Brazil"]},{code:"BSD",number:"044",digits:2,currency:"Bahamian Dollar",countries:["Bahamas (The)"]},{code:"BTN",number:"064",digits:2,currency:"Ngultrum",countries:["Bhutan"]},{code:"BWP",number:"072",digits:2,currency:"Pula",countries:["Botswana"]},{code:"BYN",number:"933",digits:2,currency:"Belarusian Ruble",countries:["Belarus"]},{code:"BZD",number:"084",digits:2,currency:"Belize Dollar",countries:["Belize"]},{code:"CAD",number:"124",digits:2,currency:"Canadian Dollar",countries:["Canada"]},{code:"CDF",number:"976",digits:2,currency:"Congolese Franc",countries:["Congo (The Democratic Republic of The)"]},{code:"CHE",number:"947",digits:2,currency:"WIR Euro",countries:["Switzerland"]},{code:"CHF",number:"756",digits:2,currency:"Swiss Franc",countries:["Liechtenstein","Switzerland"]},{code:"CHW",number:"948",digits:2,currency:"WIR Franc",countries:["Switzerland"]},{code:"CLF",number:"990",digits:4,currency:"Unidad de Fomento",countries:["Chile"]},{code:"CLP",number:"152",digits:0,currency:"Chilean Peso",countries:["Chile"]},{code:"CNY",number:"156",digits:2,currency:"Yuan Renminbi",countries:["China"]},{code:"COP",number:"170",digits:2,currency:"Colombian Peso",countries:["Colombia"]},{code:"COU",number:"970",digits:2,currency:"Unidad de Valor Real",countries:["Colombia"]},{code:"CRC",number:"188",digits:2,currency:"Costa Rican Colon",countries:["Costa Rica"]},{code:"CUC",number:"931",digits:2,currency:"Peso Convertible",countries:["Cuba"]},{code:"CUP",number:"192",digits:2,currency:"Cuban Peso",countries:["Cuba"]},{code:"CVE",number:"132",digits:2,currency:"Cabo Verde Escudo",countries:["Cabo Verde"]},{code:"CZK",number:"203",digits:2,currency:"Czech Koruna",countries:["Czechia"]},{code:"DJF",number:"262",digits:0,currency:"Djibouti Franc",countries:["Djibouti"]},{code:"DKK",number:"208",digits:2,currency:"Danish Krone",countries:["Denmark","Faroe Islands (The)","Greenland"]},{code:"DOP",number:"214",digits:2,currency:"Dominican Peso",countries:["Dominican Republic (The)"]},{code:"DZD",number:"012",digits:2,currency:"Algerian Dinar",countries:["Algeria"]},{code:"EGP",number:"818",digits:2,currency:"Egyptian Pound",countries:["Egypt"]},{code:"ERN",number:"232",digits:2,currency:"Nakfa",countries:["Eritrea"]},{code:"ETB",number:"230",digits:2,currency:"Ethiopian Birr",countries:["Ethiopia"]},{code:"EUR",number:"978",digits:2,currency:"Euro",countries:["Åland Islands","Andorra","Austria","Belgium","Croatia","Cyprus","Estonia","European Union","Finland","France","French Guiana","French Southern Territories (The)","Germany","Greece","Guadeloupe","Holy See (The)","Ireland","Italy","Latvia","Lithuania","Luxembourg","Malta","Martinique","Mayotte","Monaco","Montenegro","Netherlands (The)","Portugal","Réunion","Saint Barthélemy","Saint Martin (French Part)","Saint Pierre and Miquelon","San Marino","Slovakia","Slovenia","Spain"]},{code:"FJD",number:"242",digits:2,currency:"Fiji Dollar",countries:["Fiji"]},{code:"FKP",number:"238",digits:2,currency:"Falkland Islands Pound",countries:["Falkland Islands (The) [Malvinas]"]},{code:"GBP",number:"826",digits:2,currency:"Pound Sterling",countries:["Guernsey","Isle of Man","Jersey","United Kingdom of Great Britain and Northern Ireland (The)"]},{code:"GEL",number:"981",digits:2,currency:"Lari",countries:["Georgia"]},{code:"GHS",number:"936",digits:2,currency:"Ghana Cedi",countries:["Ghana"]},{code:"GIP",number:"292",digits:2,currency:"Gibraltar Pound",countries:["Gibraltar"]},{code:"GMD",number:"270",digits:2,currency:"Dalasi",countries:["Gambia (The)"]},{code:"GNF",number:"324",digits:0,currency:"Guinean Franc",countries:["Guinea"]},{code:"GTQ",number:"320",digits:2,currency:"Quetzal",countries:["Guatemala"]},{code:"GYD",number:"328",digits:2,currency:"Guyana Dollar",countries:["Guyana"]},{code:"HKD",number:"344",digits:2,currency:"Hong Kong Dollar",countries:["Hong Kong"]},{code:"HNL",number:"340",digits:2,currency:"Lempira",countries:["Honduras"]},{code:"HTG",number:"332",digits:2,currency:"Gourde",countries:["Haiti"]},{code:"HUF",number:"348",digits:2,currency:"Forint",countries:["Hungary"]},{code:"IDR",number:"360",digits:2,currency:"Rupiah",countries:["Indonesia"]},{code:"ILS",number:"376",digits:2,currency:"New Israeli Sheqel",countries:["Israel"]},{code:"INR",number:"356",digits:2,currency:"Indian Rupee",countries:["Bhutan","India"]},{code:"IQD",number:"368",digits:3,currency:"Iraqi Dinar",countries:["Iraq"]},{code:"IRR",number:"364",digits:2,currency:"Iranian Rial",countries:["Iran (Islamic Republic Of)"]},{code:"ISK",number:"352",digits:0,currency:"Iceland Krona",countries:["Iceland"]},{code:"JMD",number:"388",digits:2,currency:"Jamaican Dollar",countries:["Jamaica"]},{code:"JOD",number:"400",digits:3,currency:"Jordanian Dinar",countries:["Jordan"]},{code:"JPY",number:"392",digits:0,currency:"Yen",countries:["Japan"]},{code:"KES",number:"404",digits:2,currency:"Kenyan Shilling",countries:["Kenya"]},{code:"KGS",number:"417",digits:2,currency:"Som",countries:["Kyrgyzstan"]},{code:"KHR",number:"116",digits:2,currency:"Riel",countries:["Cambodia"]},{code:"KMF",number:"174",digits:0,currency:"Comorian Franc ",countries:["Comoros (The)"]},{code:"KPW",number:"408",digits:2,currency:"North Korean Won",countries:["Korea (The Democratic People’s Republic Of)"]},{code:"KRW",number:"410",digits:0,currency:"Won",countries:["Korea (The Republic Of)"]},{code:"KWD",number:"414",digits:3,currency:"Kuwaiti Dinar",countries:["Kuwait"]},{code:"KYD",number:"136",digits:2,currency:"Cayman Islands Dollar",countries:["Cayman Islands (The)"]},{code:"KZT",number:"398",digits:2,currency:"Tenge",countries:["Kazakhstan"]},{code:"LAK",number:"418",digits:2,currency:"Lao Kip",countries:["Lao People’s Democratic Republic (The)"]},{code:"LBP",number:"422",digits:2,currency:"Lebanese Pound",countries:["Lebanon"]},{code:"LKR",number:"144",digits:2,currency:"Sri Lanka Rupee",countries:["Sri Lanka"]},{code:"LRD",number:"430",digits:2,currency:"Liberian Dollar",countries:["Liberia"]},{code:"LSL",number:"426",digits:2,currency:"Loti",countries:["Lesotho"]},{code:"LYD",number:"434",digits:3,currency:"Libyan Dinar",countries:["Libya"]},{code:"MAD",number:"504",digits:2,currency:"Moroccan Dirham",countries:["Morocco","Western Sahara"]},{code:"MDL",number:"498",digits:2,currency:"Moldovan Leu",countries:["Moldova (The Republic Of)"]},{code:"MGA",number:"969",digits:2,currency:"Malagasy Ariary",countries:["Madagascar"]},{code:"MKD",number:"807",digits:2,currency:"Denar",countries:["North Macedonia"]},{code:"MMK",number:"104",digits:2,currency:"Kyat",countries:["Myanmar"]},{code:"MNT",number:"496",digits:2,currency:"Tugrik",countries:["Mongolia"]},{code:"MOP",number:"446",digits:2,currency:"Pataca",countries:["Macao"]},{code:"MRU",number:"929",digits:2,currency:"Ouguiya",countries:["Mauritania"]},{code:"MUR",number:"480",digits:2,currency:"Mauritius Rupee",countries:["Mauritius"]},{code:"MVR",number:"462",digits:2,currency:"Rufiyaa",countries:["Maldives"]},{code:"MWK",number:"454",digits:2,currency:"Malawi Kwacha",countries:["Malawi"]},{code:"MXN",number:"484",digits:2,currency:"Mexican Peso",countries:["Mexico"]},{code:"MXV",number:"979",digits:2,currency:"Mexican Unidad de Inversion (UDI)",countries:["Mexico"]},{code:"MYR",number:"458",digits:2,currency:"Malaysian Ringgit",countries:["Malaysia"]},{code:"MZN",number:"943",digits:2,currency:"Mozambique Metical",countries:["Mozambique"]},{code:"NAD",number:"516",digits:2,currency:"Namibia Dollar",countries:["Namibia"]},{code:"NGN",number:"566",digits:2,currency:"Naira",countries:["Nigeria"]},{code:"NIO",number:"558",digits:2,currency:"Cordoba Oro",countries:["Nicaragua"]},{code:"NOK",number:"578",digits:2,currency:"Norwegian Krone",countries:["Bouvet Island","Norway","Svalbard and Jan Mayen"]},{code:"NPR",number:"524",digits:2,currency:"Nepalese Rupee",countries:["Nepal"]},{code:"NZD",number:"554",digits:2,currency:"New Zealand Dollar",countries:["Cook Islands (The)","New Zealand","Niue","Pitcairn","Tokelau"]},{code:"OMR",number:"512",digits:3,currency:"Rial Omani",countries:["Oman"]},{code:"PAB",number:"590",digits:2,currency:"Balboa",countries:["Panama"]},{code:"PEN",number:"604",digits:2,currency:"Sol",countries:["Peru"]},{code:"PGK",number:"598",digits:2,currency:"Kina",countries:["Papua New Guinea"]},{code:"PHP",number:"608",digits:2,currency:"Philippine Peso",countries:["Philippines (The)"]},{code:"PKR",number:"586",digits:2,currency:"Pakistan Rupee",countries:["Pakistan"]},{code:"PLN",number:"985",digits:2,currency:"Zloty",countries:["Poland"]},{code:"PYG",number:"600",digits:0,currency:"Guarani",countries:["Paraguay"]},{code:"QAR",number:"634",digits:2,currency:"Qatari Rial",countries:["Qatar"]},{code:"RON",number:"946",digits:2,currency:"Romanian Leu",countries:["Romania"]},{code:"RSD",number:"941",digits:2,currency:"Serbian Dinar",countries:["Serbia"]},{code:"RUB",number:"643",digits:2,currency:"Russian Ruble",countries:["Russian Federation (The)"]},{code:"RWF",number:"646",digits:0,currency:"Rwanda Franc",countries:["Rwanda"]},{code:"SAR",number:"682",digits:2,currency:"Saudi Riyal",countries:["Saudi Arabia"]},{code:"SBD",number:"090",digits:2,currency:"Solomon Islands Dollar",countries:["Solomon Islands"]},{code:"SCR",number:"690",digits:2,currency:"Seychelles Rupee",countries:["Seychelles"]},{code:"SDG",number:"938",digits:2,currency:"Sudanese Pound",countries:["Sudan (The)"]},{code:"SEK",number:"752",digits:2,currency:"Swedish Krona",countries:["Sweden"]},{code:"SGD",number:"702",digits:2,currency:"Singapore Dollar",countries:["Singapore"]},{code:"SHP",number:"654",digits:2,currency:"Saint Helena Pound",countries:["Saint Helena, Ascension and Tristan Da Cunha"]},{code:"SLE",number:"925",digits:2,currency:"Leone",countries:["Sierra Leone"]},{code:"SOS",number:"706",digits:2,currency:"Somali Shilling",countries:["Somalia"]},{code:"SRD",number:"968",digits:2,currency:"Surinam Dollar",countries:["Suriname"]},{code:"SSP",number:"728",digits:2,currency:"South Sudanese Pound",countries:["South Sudan"]},{code:"STN",number:"930",digits:2,currency:"Dobra",countries:["Sao Tome and Principe"]},{code:"SVC",number:"222",digits:2,currency:"El Salvador Colon",countries:["El Salvador"]},{code:"SYP",number:"760",digits:2,currency:"Syrian Pound",countries:["Syrian Arab Republic"]},{code:"SZL",number:"748",digits:2,currency:"Lilangeni",countries:["Eswatini"]},{code:"THB",number:"764",digits:2,currency:"Baht",countries:["Thailand"]},{code:"TJS",number:"972",digits:2,currency:"Somoni",countries:["Tajikistan"]},{code:"TMT",number:"934",digits:2,currency:"Turkmenistan New Manat",countries:["Turkmenistan"]},{code:"TND",number:"788",digits:3,currency:"Tunisian Dinar",countries:["Tunisia"]},{code:"TOP",number:"776",digits:2,currency:"Pa’anga",countries:["Tonga"]},{code:"TRY",number:"949",digits:2,currency:"Turkish Lira",countries:["Türki̇ye"]},{code:"TTD",number:"780",digits:2,currency:"Trinidad and Tobago Dollar",countries:["Trinidad and Tobago"]},{code:"TWD",number:"901",digits:2,currency:"New Taiwan Dollar",countries:["Taiwan (Province of China)"]},{code:"TZS",number:"834",digits:2,currency:"Tanzanian Shilling",countries:["Tanzania, United Republic Of"]},{code:"UAH",number:"980",digits:2,currency:"Hryvnia",countries:["Ukraine"]},{code:"UGX",number:"800",digits:0,currency:"Uganda Shilling",countries:["Uganda"]},{code:"USD",number:"840",digits:2,currency:"US Dollar",countries:["American Samoa","Bonaire, Sint Eustatius and Saba","British Indian Ocean Territory (The)","Ecuador","El Salvador","Guam","Haiti","Marshall Islands (The)","Micronesia (Federated States Of)","Northern Mariana Islands (The)","Palau","Panama","Puerto Rico","Timor-Leste","Turks and Caicos Islands (The)","United States Minor Outlying Islands (The)","United States of America (The)","Virgin Islands (British)","Virgin Islands (u.s.)"]},{code:"USN",number:"997",digits:2,currency:"US Dollar (Next day)",countries:["United States of America (The)"]},{code:"UYI",number:"940",digits:0,currency:"Uruguay Peso en Unidades Indexadas (UI)",countries:["Uruguay"]},{code:"UYU",number:"858",digits:2,currency:"Peso Uruguayo",countries:["Uruguay"]},{code:"UYW",number:"927",digits:4,currency:"Unidad Previsional",countries:["Uruguay"]},{code:"UZS",number:"860",digits:2,currency:"Uzbekistan Sum",countries:["Uzbekistan"]},{code:"VED",number:"926",digits:2,currency:"Bolívar Soberano",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VES",number:"928",digits:2,currency:"Bolívar Soberano",countries:["Venezuela (Bolivarian Republic Of)"]},{code:"VND",number:"704",digits:0,currency:"Dong",countries:["Viet Nam"]},{code:"VUV",number:"548",digits:0,currency:"Vatu",countries:["Vanuatu"]},{code:"WST",number:"882",digits:2,currency:"Tala",countries:["Samoa"]},{code:"XAF",number:"950",digits:0,currency:"CFA Franc BEAC",countries:["Cameroon","Central African Republic (The)","Chad","Congo (The)","Equatorial Guinea","Gabon"]},{code:"XAG",number:"961",digits:0,currency:"Silver",countries:["Zz11_silver"]},{code:"XAU",number:"959",digits:0,currency:"Gold",countries:["Zz08_gold"]},{code:"XBA",number:"955",digits:0,currency:"Bond Markets Unit European Composite Unit (EURCO)",countries:["Zz01_bond Markets Unit European_eurco"]},{code:"XBB",number:"956",digits:0,currency:"Bond Markets Unit European Monetary Unit (E.M.U.-6)",countries:["Zz02_bond Markets Unit European_emu-6"]},{code:"XBC",number:"957",digits:0,currency:"Bond Markets Unit European Unit of Account 9 (E.U.A.-9)",countries:["Zz03_bond Markets Unit European_eua-9"]},{code:"XBD",number:"958",digits:0,currency:"Bond Markets Unit European Unit of Account 17 (E.U.A.-17)",countries:["Zz04_bond Markets Unit European_eua-17"]},{code:"XCD",number:"951",digits:2,currency:"East Caribbean Dollar",countries:["Anguilla","Antigua and Barbuda","Dominica","Grenada","Montserrat","Saint Kitts and Nevis","Saint Lucia","Saint Vincent and the Grenadines"]},{code:"XDR",number:"960",digits:0,currency:"SDR (Special Drawing Right)",countries:["International Monetary Fund (Imf) "]},{code:"XOF",number:"952",digits:0,currency:"CFA Franc BCEAO",countries:["Benin","Burkina Faso","Côte D'ivoire","Guinea-Bissau","Mali","Niger (The)","Senegal","Togo"]},{code:"XPD",number:"964",digits:0,currency:"Palladium",countries:["Zz09_palladium"]},{code:"XPF",number:"953",digits:0,currency:"CFP Franc",countries:["French Polynesia","New Caledonia","Wallis and Futuna"]},{code:"XPT",number:"962",digits:0,currency:"Platinum",countries:["Zz10_platinum"]},{code:"XSU",number:"994",digits:0,currency:"Sucre",countries:['Sistema Unitario De Compensacion Regional De Pagos "Sucre"']},{code:"XTS",number:"963",digits:0,currency:"Codes specifically reserved for testing purposes",countries:["Zz06_testing_code"]},{code:"XUA",number:"965",digits:0,currency:"ADB Unit of Account",countries:["Member Countries of the African Development Bank Group"]},{code:"XXX",number:"999",digits:0,currency:"The codes assigned for transactions where no currency is involved",countries:["Zz07_no_currency"]},{code:"YER",number:"886",digits:2,currency:"Yemeni Rial",countries:["Yemen"]},{code:"ZAR",number:"710",digits:2,currency:"Rand",countries:["Lesotho","Namibia","South Africa"]},{code:"ZMW",number:"967",digits:2,currency:"Zambian Kwacha",countries:["Zambia"]},{code:"ZWG",number:"924",digits:2,currency:"Zimbabwe Gold",countries:["Zimbabwe"]}]),uv}var cv,O2;function fY(){return O2||(O2=1,cv="2024-06-25"),cv}var B2;function hY(){if(B2)return Ka;B2=1;var r=uY(),e=cY(),t=dY(),n=fY(),i=function(c){return c=c.toUpperCase(),r(t,function(f){return f.code===c})},a=function(c){return c=c.toLowerCase(),t.filter(function(f){return(f.countries.map(function(d){return d.toLowerCase()})||[]).indexOf(c)>-1})},s=function(c){return r(t,function(f){return f.number===String(c)})},o=function(){return t.map(function(c){return c.code})},l=function(){var c=t.map(function(f){return f.number});return c.filter(function(f){if(f)return f})},u=function(){var c=t.filter(function(f){return f.countries}).map(function(f){return f.countries});return e(Array.prototype.concat.apply([],c))};return Ka.code=i,Ka.country=a,Ka.number=s,Ka.codes=o,Ka.numbers=l,Ka.countries=u,Ka.publishDate=n,Ka.data=t,Ka}var M2=hY();class iD{formatCurrencyForDisplay(e,t){const n={amount:t||0,currency:e,precision:this.getPrecisionForCurrency(e)};return lY(n).toFormat(this.getSpecialFormat(e))}getPrecisionForCurrency(e){const t=e,n=M2.code(t);return n?n.digits:2}getSpecialFormat(e){const t=e;if(M2.code(t)?.code==="CLP")return"USD0,0"}}const _2=new iD;class aD{constructor(e,t,n,i){this.presentmentCurrency=void 0,this.presentmentCurrency=i,this.partnerCurrency=n,this.rateFrom=e,this.rateTo=t}code(){return this.presentmentCurrency?this.presentmentCurrency:this.partnerCurrency}conversionRequired(){return this.presentmentCurrency!==void 0&&this.code()!==this.partnerCurrency}getConvertedSubunits(e){return this.conversionRequired()?Math.ceil(this.subunits(this.units(e,this.partnerCurrency)/this.rateFrom*this.rateTo,this.code())):e}units(e,t){return e/Math.pow(10,_2.getPrecisionForCurrency(t))}subunits(e,t){return e*Math.pow(10,_2.getPrecisionForCurrency(t))}}const pY=Ce`
|
|
3063
3066
|
query GlobalPropertyTemplatesFeed(
|
|
3064
3067
|
$limit: Int!
|
|
3065
3068
|
$offset: Int!
|
|
@@ -3086,8 +3089,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3086
3089
|
total
|
|
3087
3090
|
}
|
|
3088
3091
|
}
|
|
3089
|
-
`;class
|
|
3090
|
-
${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:"all",variables:n,context:{logRequestHeaders:!0}});if(i.error)throw console.log("[getWorkflowsInternal] Response errored."),i.error;if(i.errors)throw i.errors.forEach(s=>console.error(s)),new Error("Unable to read workflows. Consult GraphQL errors.");if(!i.data.workflows||i.data.workflows.length!==r.length)throw new Error(`Unable to read workflows: ${i.errors??"Length mismatch in response"}`);const a=Ao(i.data.workflows);return a.forEach(s=>{s.finalizeStepConfig||(s.finalizeStepConfig={}),s.finalizeStepConfig.termsMarkdown=s.finalizeStepConfig.termsMarkdown||s.partner.termsMarkdown}),a},mY=async(r,e)=>{const n=(await e).find(i=>i.id===r);if(!n)throw new Error(`Workflow not found: ${r}`);return n},fw=async(r,e)=>{const t=r.map(o=>Af.get({id:o,options:e})),n=r.filter((o,l)=>t[l]===void 0);if(n.length===0)return Promise.all(t);const i=gY(n,e),a=n.map(o=>Af.set({id:o,options:e},mY(o,i))),s=t.filter(o=>o!==void 0);return await Promise.all(s.concat(a))},sD=async(r,e)=>(await fw([r],e))[0],oD=async r=>{const e=await Le.getShadowGraphqlClient().query({query:PT,variables:{ids:r},errorPolicy:"all",fetchPolicy:"no-cache"});return e.errors&&console.error(e.errors),e.data.integrationProducts||[]};class yY{constructor(e){this.activeIntegration=void 0,this.updateTransactionState=async t=>{try{return Le.getShadowGraphqlClient().mutate({...t,mutation:eM})}catch(n){throw console.error(n),new fo("Critical - Unable to synchronize workflow state with server.")}},this.options=e,this.options.applicationKey&&oT(this.options.applicationKey),console.debug("------------------------"),console.debug("Spiff Commerce Core SDK"),console.debug("Version: 44.7.1"),console.debug(`Application Key Provided: ${!!this.options.applicationKey}`),console.debug("------------------------")}configure(e){ls.setHubUrl(e.hubUrl),ls.setServerUrl(e.serverUrl),ls.setServicesApiUrl(e.servicesApiUrl),this.marketplaceThemeInstallId=e.marketplaceThemeInstallId,this.marketplaceThemeInstallConfigurationId=e.marketplaceThemeInstallConfigurationId,this.userPoolClientId=e.userPoolClientId,this.userPoolRegion=e.userPoolRegion,this.spiffRegion=e.spiffRegion,e.bearerAuthenticationToken&&uT(e.bearerAuthenticationToken),this.options.applicationKey&&this.getIntegration(),this.spiffRegion&&this.userPoolRegion&&this.userPoolClientId&&Dd.init(this.spiffRegion,this.userPoolRegion,this.userPoolClientId)}getVersion(){return"44.7.1"}getAssetManager(){return Un}async getBetaEnabled(){return this.options.enableBetaFeatures?!0:(await this.getIntegration()).partner.beta===!0}getFlowService(){if(!bB())throw new Error("Application key required to use Flow Service.");return new nP}async getCurrencyContext(e){const n=(await this.getIntegration()).partner.currencyCode,a=await Le.getShadowGraphqlClient().query({query:wM,errorPolicy:"all",fetchPolicy:"cache-first",variables:{from:n,to:e}}),{rateFrom:s,rateTo:o}=a.data.currencyConversion;return new aD(s,o,n,e)}async getIntegration(){if(this.activeIntegration)return this.activeIntegration;if(!this.options.applicationKey)throw new Error("Cannot get current Integration without specifying an Application Key.");return this.activeIntegration=lD(this.options.applicationKey),this.activeIntegration}async canUseAddon(e){try{return(await this.getIntegration()).partner.activeAddons?.includes(e)??!1}catch(t){return console.error(t),!1}}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(e){const t=wr.getMap("transactionCustomerIds");t?.has(e)&&(t.delete(e),wr.setMap("transactionCustomerIds",t))}async customerHasBundleTemplates(e){const i=(await Le.getShadowGraphqlClient().query({query:Ly,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;return i.id?i.hasBundleTemplates??!1:!1}getStakeholderTypeForTransaction(e){const t=this.customer?.stakeholders?.find(n=>n.transaction?.id===e);if(t)return t.type}async getOrCreateCustomer(e){this.customer=void 0;const t=Le.getShadowGraphqlClient(),i=(await t.query({query:Ly,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;if(!i.id){const o=(await t.mutate({mutation:QV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:e}}})).data?.customerCreate;if(!o)throw new Error("Unable to create customer.");return this.storeCustomer(o),this.customer=o,{customer:o,isAuthenticated:!1}}this.storeCustomer(i);const a=await this.reloadLoggedInCustomer();return{customer:this.customer||i,isAuthenticated:a}}getCustomer(){return this.customer}async reloadLoggedInCustomer(){const e=localStorage.getItem("last-refreshed-cognito-tokens"),t=localStorage.getItem("cognito-tokens"),n=localStorage.getItem("cognito-email");if(!e||!t||!n)return!1;const i=JSON.parse(t),a=new Date().getTime()/1e3;if(!i.ExpiresIn||i.ExpiresIn<a-parseInt(e)){const u=await Dd.refreshTokens();if(u?.AuthenticationResult)localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),i.AccessToken=u.AuthenticationResult.AccessToken,localStorage.setItem("cognito-tokens",JSON.stringify(i));else return this.logOut(),console.error("Failed to refresh tokens."),!1}const s=localStorage.getItem("customer-login-token");s&&A0(s);const l=(await Le.getShadowGraphqlClient().query({query:Ly,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:n}})).data.customer;return l.id?(this.customer=l,!0):(console.error("Failed to get customer."),!1)}async generateVerificationCode(e){await Le.getShadowGraphqlClient().mutate({mutation:YV,variables:{emailAddress:e}}),await Dd.generateCode(e)}async verifyCode(e,t){const n=(await this.getIntegration()).partner.id||"",i=await Dd.verifyCode(e,t,n);if(i?.AuthenticationResult){localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),localStorage.setItem("cognito-tokens",JSON.stringify(i.AuthenticationResult)),localStorage.setItem("cognito-email",e);const s=(await Le.getShadowGraphqlClient().mutate({mutation:XV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e,verificationCode:t}})).data?.customerVerifyCode;if(!s?.id)throw new Error("Failed to get customer.");return this.customer=s,s.loginToken&&(localStorage.setItem("customer-login-token",s.loginToken),A0(s.loginToken)),!0}else throw new Error}async logOut(){localStorage.removeItem("last-refreshed-cognito-tokens"),localStorage.removeItem("cognito-tokens"),localStorage.removeItem("cognito-email"),localStorage.removeItem("customer-login-token"),A0(""),this.clearCustomer()}async loggedInBearerToken(){const e=localStorage.getItem("last-refreshed-cognito-tokens"),t=localStorage.getItem("cognito-tokens");if(!e||!t)throw new Error("No token data in storage.");const n=JSON.parse(t),i=new Date().getTime()/1e3,a=!n?.AccessToken||xg(n.AccessToken);if(!n.ExpiresIn||n.ExpiresIn<i-parseInt(e)||a){const s=await Dd.refreshTokens();if(s?.AuthenticationResult)localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),n.AccessToken=s.AuthenticationResult.AccessToken,localStorage.setItem("cognito-tokens",JSON.stringify(n));else throw this.logOut(),new Error("Failed to refresh tokens.")}if(!n.AccessToken)throw new Error("No bearer token in storage.");return n.AccessToken}async getCustomerMetafields(){if(!this.customer?.id)throw new Error("Customer must be logged in before calling this function.");return(await Le.getShadowGraphqlClient().query({query:JV,variables:{id:this.customer.id}})).data.metafields}async getNewBundle(e,t,n,i){const s=(await Le.getShadowGraphqlClient().mutate({mutation:M9(n?.graphql?.productCollection?.eagerFetchProducts||!1),variables:{collectionId:e,initialMetadata:t?Object.entries(t).map((c,f)=>({key:c[0],value:c[1]})):void 0,marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId,activationId:i,test:n?.test},fetchPolicy:"no-cache"})).data?.bundleCreate;if(!s?.id)throw new Error("Unable to create bundle");const o=wr.getMap("bundlePartnerIds")||new Map;o.set(s.id,s.partner.id),wr.setMap("bundlePartnerIds",o);const l=wr.getMap("bundleOwnerIds")||new Map;l.set(s.id,s.bundleOwnerId),wr.setMap("bundleOwnerIds",l);const u=new HE(this,s,void 0,void 0,s.bundleOwnerId,{eagerFetchProducts:n?.graphql?.productCollection?.eagerFetchProducts});return await u.getInitializationPromise(),u}async getExistingBundle(e,t,n,i,a){const o=wr.getMap("bundleOwnerIds")?.get(e),l={};try{const g=await this.loggedInBearerToken();l.Authorization=`Bearer ${g}`}catch{const v=Object.entries(localStorage).find(([x,S])=>x.startsWith("CognitoIdentityServiceProvider")&&x.endsWith("idToken"))?.[0]||"",A=localStorage.getItem(v);A&&!xg(A)&&(l.Authorization=`Bearer ${A}`)}const u={bundleOwnerId:o,...l,...i?.graphql?.additionalHeaders},c=await Le.getShadowGraphqlClient().query({query:D9(i?.graphql?.productCollection?.eagerFetchProducts||!1),variables:{id:e},fetchPolicy:"no-cache",context:{headers:u}});if(!c.data?.bundles||c.data?.bundles.length===0||!c.data?.bundles[0])throw new Error(`Unable to find bundle: ${e}`);const f=c.data?.bundles[0],d=wr.getMap("bundlePartnerIds")||new Map;d.set(f.id,f.partner.id),wr.setMap("bundlePartnerIds",d);const h=new HE(this,f,t,n,o,{additionalHeaders:i?.graphql?.additionalHeaders,eagerFetchProducts:i?.graphql?.productCollection?.eagerFetchProducts,existingGlobalPropertyState:c.data.globalPropertyState,readonly:i?.readonly},a);return await h.getInitializationPromise(),h}async duplicateBundle(e,t,n,i){const s={...await dD(e),...i?.graphql?.additionalHeaders},l=(await Le.getShadowGraphqlClient().mutate({mutation:_9(),variables:{id:e,template:t,marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId,duplicateTransactions:n,test:i?.test},context:{headers:s},fetchPolicy:"no-cache"})).data?.bundleDuplicate;if(!l?.id)throw new Error("Unable to duplicate bundle");const u=wr.getMap("bundlePartnerIds")||new Map;u.set(l.id,l.partner.id),wr.setMap("bundlePartnerIds",u);const c=wr.getMap("bundleOwnerIds")||new Map;return c.set(l.id,l.bundleOwnerId),wr.setMap("bundleOwnerIds",c),async()=>await this.getExistingBundle(l.id,void 0,void 0,{graphql:{productCollection:{eagerFetchProducts:i?.graphql?.productCollection?.eagerFetchProducts||!1}}})}async getBundlesForCustomer(e){if(!this.customer?.id)throw new Error("Customer not authenticated.");const{includeMetadata:t,...n}=e;return(await Le.getShadowGraphqlClient().query({query:W9(t??!1),variables:{...n,id:this.customer.id},fetchPolicy:"no-cache"})).data.customerBundlesFeed}async getTemplatesForCustomer(e){if(!this.customer?.id)throw new Error("Customer not authenticated.");const t=await Le.getShadowGraphqlClient().query({query:hY,variables:{...e,id:this.customer.id},fetchPolicy:"no-cache"});return{total:t.data.globalPropertyTemplatesFeed.total,items:t.data.globalPropertyTemplatesFeed.items.map(n=>new pY(n))}}async getBundleStakeholders(){if(!this.customer)throw new Error("Customer not authenticated.");const e=await Le.getShadowGraphqlClient().query({query:R9,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!e.data?.customers||e.data.customers.length===0)throw new Error("Unable to find customer.");const n=e.data.customers[0].bundleStakeholders||[],i=wr.getMap("bundlePartnerIds")||new Map;return n.forEach(a=>{a.bundle?.id&&a.bundle.partner?.id&&i.set(a.bundle.id,a.bundle.partner.id)}),wr.setMap("bundlePartnerIds",i),n}async getWorkflowExperience(e,t){if(!e)throw new Error("getWorkflowExperience has been called without an options object! This is not supported.");const n=await this.getWorkflowExperiences([e],e.graphql),i=n[0],a=i.getWorkflow();return t&&!a&&console.error("No workflow instantiated when trying to create preview service."),t&&a&&await i.getWorkflowManager().injectIntoPreviewService(t(a)),n[0]}async getWorkflowExperiences(e,t,n,i){if(e.length===0)throw new fo("No options provided!");const a=e.map((U,$)=>({option:U,index:$})),s=a.filter(U=>U.option.type==="transaction"),o=a.filter(U=>U.option.type==="integration"||U.option.type==="external"||U.option.type==="blank"),l=50,u=xA(s,l),c=xA(o,l);let f=0;const d=Le.getShadowGraphqlClient(),h=async U=>{if(U.length===0)return[];const $=U.map(K=>K.option.transactionId),z=await d.query({query:Z3,variables:{ids:$},errorPolicy:"all",fetchPolicy:"no-cache"}),Q=z.data.transactions;if(f=f+Q.length,i&&i(f,s.length),Q.length!==U.length){const K=z.errors?.[0]?.message||"Unknown error";throw new fo(`Not all transactions were found: ${K}`)}return!this.activeIntegration&&Q[0].integrationProduct?.integration&&(this.activeIntegration=Promise.resolve(Q[0].integrationProduct.integration)),Q.map((K,le)=>({transaction:K,workflowId:K.workflowId,readOnly:U.find(he=>he.option.transactionId===K.id)?.option.readOnly??!1,index:U[le].index}))},g=async U=>{if(U.length===0)return[];const $=await d.mutate({mutation:K3,variables:{inputs:U.map(Q=>({integrationProductId:Q.option.type==="integration"?Q.option.integrationProductId:void 0,externalIntegrationId:Q.option.type==="external"?Q.option.externalIntegrationId:void 0,externalProductId:Q.option.type==="external"?Q.option.externalProductId:void 0,workflowId:Q.option.workflowId,designName:Q.option.designName,claim:!0,quantity:Q.option.quantity,recipient:Q.option.recipient,parentTransactionId:Q.option.parentTransactionId})),marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId},errorPolicy:"all",fetchPolicy:"no-cache",context:this.getCreateTransactionContext(U,t)}),z=$.data?.transactionCreateMany;if(!z||z.length===0){const Q=$.errors?.[0]?.message||"Unknown error";throw new fo(`Failed to create transactions: ${Q}`)}return f=f+z.length,i&&i(f,s.length),z.map((Q,K)=>({transaction:Q,workflowId:Q.workflowId,readOnly:!1,index:U[K].index}))},y=(await Promise.all([...u.map(h),...c.map(g)])).flat();let v=[...new Set(y.map(U=>U.transaction.integrationProductId))].filter(U=>!!U);v=v.filter(U=>!!U);let A=[...new Set(y.map(U=>U.workflowId))].filter(U=>!!U);A=A.filter(U=>!!U);const[x,S]=await Promise.all([(async()=>v.length>0?await oD(v):[])(),(async()=>A.length>0?await fw(A,t):[])()]),F=new Map(x.map(U=>[U.id,U])),E=new Map(S.map(U=>[U.id,U])),R=y.map(async U=>{const{transaction:$,workflowId:z,readOnly:Q,index:K}=U,le=z?E.get(z):void 0,he=e[K];if($.integrationProductId){const ue=F.get($.integrationProductId);$.integrationProduct=ue,$.product=ue?.product,$.integrationProduct||console.error("failed to find transaction's product")}const Me=wr.getMap("transactionOwnerIds")||new Map;!Me.get($.id)&&$.transactionOwnerId&&(Me.set($.id,$.transactionOwnerId),wr.setMap("transactionOwnerIds",Me));const De=Me.get($.id)||void 0,Pe=new KV({onMutate:()=>({context:{transactionOwnerId:De,bundleOwnerId:t?.bundleOwnerId}}),onQuery:()=>({context:{transactionOwnerId:De,bundleOwnerId:t?.bundleOwnerId}})}),re={workflow:le,transaction:$,singleVariantsRenderable:he?.workflowConfiguration?.singleVariantsRenderable,stateMutationFunc:Q?async()=>{throw new an("State mutation is forbidden in read only mode!")}:async ue=>this.updateTransactionState({...ue,context:{transactionOwnerId:De,bundleOwnerId:t?.bundleOwnerId}}),graphQlClient:()=>Pe,readOnly:Q,isReloadedTransaction:he.type==="transaction"};if(he.type==="transaction"&&$.workflowState){const ue=JSON.parse($.workflowState);await gA(ue),re.reloadedState=ue}else if(!Q&&he.workflowState){const ue=JSON.parse(he.workflowState);await gA(ue),re.reloadedState=ue}return re.delayWorkflowStateSync=!0,{experienceOptions:re,index:K,options:he}}),W=(await Promise.all(R)).sort((U,$)=>U.index-$.index);let Y=[],ae=[];for(const U of W){const{experienceOptions:$,options:z}=U,Q=new q1(this,$);await Q.getWorkflowManager().getInitializationPromise(),n&&n(),z.type!=="transaction"&&this.customer&&ae.push(Q),Y=[...Y,Q],Q.getWorkflowManager().setWorkflowStateSyncEnabled(!0)}if(ae.length>0){const U=this.customer.emailAddress,$=ae.map(K=>K.getTransaction().id),Q=(await d.mutate({mutation:xV,variables:{ids:$,details:{emailAddress:U},type:"Owner"},errorPolicy:"all"})).data?.transactionsAddStakeholder;if(Q&&Q?.length>0){const K=Q[0].stakeholders?.find(le=>le.customer?.emailAddress===U);if(K?.customer)for(const le of ae)le.assignCustomerInternal(K.customer)}}return Y}getCreateTransactionContext(e,t){const n=e.find(s=>s.option.parentTransactionId)?.option.parentTransactionId;if(!n&&!t?.bundleOwnerId)return;const i=wr.getMap("transactionOwnerIds")||new Map,a=n?i.get(n):void 0;return{...a?{transactionOwnerId:a}:{},...t?.bundleOwnerId?{bundleOwnerId:t.bundleOwnerId}:{}}}storeCustomer(e){const t=wr.getMap("partnerCustomerIds")||new Map;t.set(e.partner.id,e.id),wr.setMap("partnerCustomerIds",t)}async getIntegrationProductById(e,t){const a=(await Le.getShadowGraphqlClient().query({query:oM(t),variables:{ids:[e]},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.integrationProducts;if(!a||a.length===0||!a[0]?.id)throw new Error("Integration product not found.");return new EA(a[0])}async getIntegrationProductFromExternalIds(e,t,n){const s=(await Le.getShadowGraphqlClient().query({query:lM(n),variables:{externalProductId:t,externalIntegrationId:e},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.integrationProductFromExternalIds;if(!s?.id)throw new Error("Integration product not found.");return new EA(s)}async getIntegrationProduct(e){return e.type==="integration"?this.getIntegrationProductById(e.integrationProductId):this.getIntegrationProductFromExternalIds(e.externalIntegrationId,e.externalProductId)}async getShareActionsForTransaction(e){const n=(wr.getMap("transactionOwnerIds")||new Map).get(e)||void 0,i=await Le.getShadowGraphqlClient().query({query:aM,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e},context:{transactionOwnerId:n}});if(!i.data.transactions||i.data.transactions.length!==1)throw new Error(`Failed to fetch share actions for transaction: ${e}`);return i.data.transactions[0].transactionShareActions}async placeOrder(e){const t=await Le.getShadowGraphqlClient().mutate({mutation:bM,variables:{orderItems:e}});if(t.errors)throw new Error(t.errors[0].message);if(!t.data)throw new Error("Failed to create order: No order data in response.");return{id:t.data.orderCreate.id,internalId:t.data.orderCreate.internalId}}}const lD=async(r,e)=>(await Le.getShadowGraphqlClient().query({query:yM,errorPolicy:"all",fetchPolicy:"no-cache",context:{headers:{"x-application-key":r},skipIntegrationCheck:!0},variables:{themeConfigurationId:e}})).data.currentIntegration,vY=async r=>{const t=await Le.getShadowGraphqlClient().query({query:iM,errorPolicy:"all",fetchPolicy:"network-only",variables:{id:r}});if(t.data.transactions.length!==0)return t.data.transactions[0]},AY=async(r,e)=>(await Le.getShadowGraphqlClient().query({query:mM,errorPolicy:"all",variables:{themeConfigurationId:r,themeInstallId:e}})).data?.marketplaceThemeInstallConfiguration,bY=async r=>(await Le.getShadowGraphqlClient().query({query:AM,errorPolicy:"all",variables:{id:r}})).data?.bundles?.[0]?.marketplaceThemeInstallConfiguration,wY=async r=>(await Le.getShadowGraphqlClient().query({query:vM,errorPolicy:"all",variables:{id:r}})).data?.transactions?.[0]?.marketplaceThemeInstallConfiguration,uD=async(r,e)=>(await Le.getShadowGraphqlClient().query({query:FM(!!e),errorPolicy:"all",variables:{id:r,productIds:e}})).data?.activation,xY=async r=>(await uD(r))?.marketplaceThemeInstallConfiguration;async function cD(){const r={};try{const e=await this.loggedInBearerToken();r.Authorization=`Bearer ${e}`}catch{const n=Object.entries(localStorage).find(([a,s])=>a.startsWith("CognitoIdentityServiceProvider")&&a.endsWith("idToken"))?.[0]||"",i=localStorage.getItem(n);i&&!xg(i)&&(r.Authorization=`Bearer ${i}`)}return r}async function dD(r){const t=wr.getMap("bundleOwnerIds")?.get(r),n=await cD();return{bundleOwnerId:t,...n}}async function CY(r){const t=wr.getMap("transactionOwnerIds")?.get(r),n=await cD();return{transactionOwnerId:t,...n}}const SY=async r=>{const e=await dD(r),t=await Le.getShadowGraphqlClient().mutate({mutation:rV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r},context:{headers:e}});if(t.data?.bundleDelete!==r)throw new Error(`Failed to delete bundle: ${t.errors}`)},EY=async r=>{const e=await CY(r),t=await Le.getShadowGraphqlClient().mutate({mutation:nV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{ids:[r]},context:{headers:e}});if(!t.data?.transactions||t.data.transactions.length!==1||t.data.transactions[0].id!==r)throw new Error(`Failed to find transaction to read bundle id: ${JSON.stringify(t.errors)}`);return t.data.transactions[0].bundle?.id};function fD(r,e,t,n){const i=t.width*r.zoom,a=t.height*r.zoom;if(n){const s=Math.max(e.width/t.width,e.height/t.height),o=Math.max(s,r.zoom),l=t.width*o,u=t.height*o;return{...r,x:Bp(r.x,e.width-l,0),y:Bp(r.y,e.height-u,0),zoom:o}}return{...r,x:Bp(r.x,-i,e.width),y:Bp(r.y,-a,e.height)}}function Bp(r,e,t){return Math.min(Math.max(r,e),t)}class hD{constructor(e,t){this.minZoomScale=[.03],this.maxZoomScale=[20],this._debouncedUpdateFrameOffsets=v1(this.updateFrameOffsets,200),this.targetElements=[],this.onFrameDataChangeListeners=[],this.onZoomChangeListeners=[],this.onRotationChangeListeners=[],this.forceImageCover=e,this.initialZoom=t,this.thresholdSettings={useThreshold:!1,invertThreshold:!1,threshold:128,thresholdSaturation:.5}}connectWorkflowManager(e,t){t&&e.addStepSpecificStorageCallback(async n=>{if(n){const i=n;if(i.currentFrameSources){let a=!1;for(let s=0;s<i.currentFrameSources.length;s++){const o=i.currentFrameSources[s],l=await Zf(o),u=this.frameData?this.frameData[s]:void 0;wf(l,u)||(this.frameData||(this.frameData=new Array(i.currentFrameSources.length)),this.frameData[s]=l,a=!0)}a&&(this.onFrameDataChangeListeners.forEach(s=>s(this.frameData)),this.frameData&&this.imageData&&(this.recalculateOffsets(this.imageData),this.updateOffsets(this.offsets),this.recalculateZoomLimits(this.imageData,this.frameData)))}}},t),this.workflowManager=e,this.stepName=t}setTargetElements(e){this.targetElements=e}getFrameData(){return this.frameData}setFrameData(e){if(!e){this.frameData=void 0;return}e.forEach((t,n)=>{const i=Uu.get(t);i&&(this.frameData||(this.frameData=new Array(e.length)),this.frameData[n]=i)})}getImageData(){return this.imageData}getImageSrc(){if(this.imageData){if(this.imageData.svg){const e=qg(this.imageData.svg,this.imageData.colors||{},!1);return Gg(e)}return this.imageData.src}}getOffsets(){return this.offsets}setOffsets(e){this.offsets=e}setZoom(e,t,n,i){if(this.imageData&&this.offsets&&this.frameData){(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length));const a=this.frameData.map((s,o)=>{const l=(t[o]-this.offsets[o].x)/this.offsets[o].zoom,u=(n[o]-this.offsets[o].y)/this.offsets[o].zoom,c=t[o]-l*e[o],f=n[o]-u*e[o];return{x:c,y:f,zoom:this.imageData.width*e[o]/this.imageData.width,rotation:this.offsets[o].rotation}});this.updateOffsets(a,i),this.onZoomChangeListeners.forEach(s=>s(e))}}setRotation(e,t){if(this.imageData&&this.offsets&&this.frameData){(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length));const n=this.frameData.map((i,a)=>({...this.offsets[a],rotation:e[a]}));this.updateOffsets(n,t),this.onRotationChangeListeners.forEach(i=>i(e))}}setPatternData(e,t=!0){this.imageData=e,e&&this.frameData&&((t||!this.offsets)&&this.recalculateOffsets(e,t),this.updateOffsets(this.offsets,void 0,!0)),this.imageData&&this.frameData&&this.recalculateZoomLimits(this.imageData,this.frameData)}updateOffsets(e,t,n){const i=this.imageData;if(!i||!this.frameData)return;if(this.frameData.length!==e.length)throw new an("Frame data and offsets are not the same length. This is a bug. Please report it.");if(!this.offsets.some((s,o)=>!(e[o].x===s.x&&e[o].y===s.y&&e[o].zoom===s.zoom&&e[o].rotation===s.rotation))&&!n){t&&t();return}(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length)),this.frameData.forEach((s,o)=>{this.offsets[o]=fD(e[o],s,this.imageData,this.forceImageCover)}),this._debouncedUpdateFrameOffsets(this.offsets,i,this.frameData,this.thresholdSettings,t)}getThresholdSettings(){return this.thresholdSettings}setThresholdSettings(e){this.thresholdSettings=e,this.imageData&&this.frameData&&this._debouncedUpdateFrameOffsets(this.offsets,this.imageData,this.frameData,e)}onFrameDataChanged(e){e(this.frameData),this.onFrameDataChangeListeners.push(e)}onZoom(e){this.onZoomChangeListeners.push(e)}onRotation(e){this.onRotationChangeListeners.push(e)}updateFrameOffsets(e,t,n,i,a){if(!n||n.length===0||n.some(l=>!l))throw new an("Frame data not set. This is a bug");if(!this.workflowManager)throw new an("No workflow manager set, cannot update offsets.");const s=this.workflowManager.getRegionElements(this.stepName||""),o=this.workflowManager.getCommandDispatcher();this.targetElements.forEach((l,u)=>{let c=s.find(f=>f.id===l)?.regionIndex??u;c>=e.length&&(c=u);try{o(new In([new YL(l,t,e[c]),new XL(l,i.useThreshold,i.invertThreshold,i.threshold,i.thresholdSaturation)]))}catch{}}),this.stepName&&this.workflowManager.updateStorage(this.stepName,{frameOffsetsList:e}),a&&a()}recalculateZoomLimits(e,t){(this.minZoomScale.length!==t.length||this.maxZoomScale.length!==t.length)&&(this.minZoomScale=new Array(t.length),this.maxZoomScale=new Array(t.length)),t.forEach((n,i)=>{const a=Math.max(n.width/e.width,n.height/e.height);this.forceImageCover?(this.minZoomScale[i]=a,this.maxZoomScale[i]=a*2.5):(this.minZoomScale[i]=a/10,this.maxZoomScale[i]=a*2.5)})}recalculateOffsets(e,t=!0){this.frameData&&((!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length)),this.frameData.forEach((n,i)=>{const a=t?0:this.offsets[i]?.rotation||0;this.offsets[i]={...O1(e,n,this.initialZoom&&!this.forceImageCover?{scale:this.initialZoom}:void 0,this.forceImageCover),rotation:a}}),this._debouncedUpdateFrameOffsets(this.offsets,e,this.frameData,this.thresholdSettings))}}class kY{traversableScenes(){throw new Error("Method not implemented.")}updateRecipient(e,t,n,i,a,s,o,l,u,c,f,d,h,g,y,v,A){throw new Error("Method not implemented.")}approveTransaction(e){throw new Error("Method not implemented.")}rejectTransaction(e){throw new Error("Method not implemented.")}getClient(){return this.client??{}}getWorkflowExperience(){return{}}setClient(e){this.client=e}getInitializationPromise(){return Promise.resolve()}async updateWorkflowConfiguration(e){throw new Error("Method not implemented.")}isInitialized(){return!0}getInformationResults(){return[]}async reset(){}updateStateWithServer(e){}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(e){}addPoller(e){}addConfirmCallback(e){}addEditedCallback(e){}addElementsCallback(e){}addInformationResultCallback(e){}addInitCallback(e){}addMakingAdjustmentsCallback(e){}addMandatoryCallback(e){}addMetadataCallback(e){}addSelectionCallback(e){}addStepSpecificStorageCallback(e,t){}addStorageCallback(e){}getCommandDispatcher(){return e=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getRegionElements(e){return[]}getSerializedStep(e,t){}getStepSpecificServices(e){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getInitialOptionIds(){return new Promise(()=>new Set)}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(e){}markUpdateCompleted(e){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}getStepSelections(){return{}}setCurrentAdjustingStepId(e){}setEditedStatus(e,t){}setInformationResults(e){}setMandatoryFulfilled(e,t){}async setSelectionsAndElements(e,t,n){}toggleDesignConfirmed(){}updateMetadata(e,t){}async updateStorage(e,t){}injectIntoPreviewService(e){return Promise.resolve()}ejectFromPreviewService(){}setWorkflowStateSyncEnabled(e){}async updateTransactionShareActions(){}addValidationCallback(e){}setStepError(e,t,n){}getStepErrors(e){}getValidationErrors(){return{steps:new Map}}async updateTransactionStakeholders(){}getStepTags(e){return[]}}var pD=(r=>(r.SelectFrame="SelectFrame",r.SelectImage="SelectImage",r.Position="Position",r))(pD||{}),gD=(r=>(r.Original="original",r.BackgroundRemoved="backgroundRemoved",r.Optimized="optimized",r))(gD||{});class mD extends $i{constructor(e,t,n){super(e,t,n);const i=t.data;this.frameService=new hD(i.forceImageCover,i.initialZoomLevel),this.frameService.connectWorkflowManager(e,t.stepName)}selectVariant(e){const t=this.manager.getRegionElements(this.step.stepName);return uo.selectVariant(this.step,e.getResource(),t,this.manager,n=>this.setUpdateState(n))}onFrameDataChanged(e){this.frameService&&this.frameService.onFrameDataChanged(t=>{t&&e(t)})}async selectImage(e,t=!0,n=!0){await uo.selectImage(this.step,e,this.manager,n),t&&this.manager.updateStorage(this.step.stepName,{framePatternData:{originalAssetKey:e.key,backgroundRemovedAssetKey:void 0,vectorizedAssetKey:void 0,enhancedAssetKey:void 0,useOriginalAsset:void 0}})}async canUseAdvancedImageManipulation(){return this.manager.getClient().canUseAddon(Ug.AdvancedImageManipulation)}async canRemoveBackground(){return await this.canUseAdvancedImageManipulation()&&this.hasOriginalImageSelection()&&!!this.frameService?.getImageData()?.src&&!this.frameService?.getImageData()?.svg}async removeBackgroundFromImageSelection(e=!0){if(!await this.canUseAdvancedImageManipulation())throw new Error("The current Integration does not have access to the Background Remover. Please call canUseAdvancedImageManipulation to ensure you disable this feature when appropriate.");const t=await this.getOriginalImageSelection();if(!t)throw new Error("You must supply an image selection before attempting to remove the background.");const n=await Un.removeBackgroundFromAsset(t);e&&await uo.selectImage(this.step,n,this.manager,!1);const i=this.getFrameStepStorage()?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...i,backgroundRemovedAssetKey:n.key,useOriginalAsset:!e}}),n}async vectorize(e,t=void 0){const n=e??await this.getOriginalImageSelection();if(!n)throw new Error("You must supply an image selection before attempting to vectorize the image.");const i=await Un.vectorizeAsset(n,t);await this.selectImage(i,!1);const a=this.getFrameStepStorage()?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...a,vectorizedAssetKey:i.key,useOriginalAsset:!1}}),i}async enhanceWithAI(e,t){const n=e??await this.getOriginalImageSelection();if(!n)throw new Error("You must supply an image selection before attempting to enhance the image with AI.");const i=await Un.enhanceWithAI(n,t);await this.selectImage(i,!1);const a=this.getFrameStepStorage()?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{originalAssetKey:a.originalAssetKey,backgroundRemovedAssetKey:a.backgroundRemovedAssetKey,vectorizedAssetKey:a.vectorizedAssetKey,enhancedAssetKey:i.key,useOriginalAsset:!1}}),i}async getBackgroundRemovedImageSelection(){const e=this.getFrameStepStorage()?.framePatternData?.backgroundRemovedAssetKey;if(e)return Un.getLocalOrFromServer(e)}async getVectorizedImageSelection(){const e=this.getFrameStepStorage()?.framePatternData?.vectorizedAssetKey;if(e)return Un.getLocalOrFromServer(e)}async getEnhancedImageSelection(){const e=this.getFrameStepStorage()?.framePatternData?.enhancedAssetKey;if(e)return Un.getLocalOrFromServer(e)}hasOriginalImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.originalAssetKey}hasBackgroundRemovedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.backgroundRemovedAssetKey}hasVectorizedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.vectorizedAssetKey}hasEnhancedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.enhancedAssetKey}async changeColors(e){await uo.changeColors(this.step,this.manager,e)}getImageData(){if(this.frameService)return this.frameService.getImageData()}async getColorOption(){return await ct.ensureFullOption(this.step.data.colorOption)}getAvailableColors(){return this.step.data.colorPickerEnabled?uo.availableColors(this.step,this.manager):Promise.resolve([])}isColorPickerEnabled(){return this.step.data.colorPickerEnabled??!1}async getOriginalImageColors(){const e=this.getImageData();return e?.svg?(await Ra(e.svg)).colors:void 0}async mergeColors(e,t,n){const i=this.frameService.getImageData();if(!i?.svg||!i.colors)throw new Error("Cannot merge colors on non-SVG image or image without color information");const{svg:a,colors:s}=ST(i.svg,i.colors,e,t,n);this.frameService.setPatternData({...i,svg:a,colors:s},!1),this.manager.updateStorage(this.step.stepName,{colors:s})}async unmergeColors(e,t,n,i){const a=this.frameService.getImageData();if(!a?.svg||!a.colors)throw new Error("Cannot unmerge colors on non-SVG image or image without color information");this.frameService.setPatternData({...a,svg:i,colors:n},!1),this.manager.updateStorage(this.step.stepName,{colors:n})}getShouldVectorize(){return this.step.data.shouldVectorize??!1}getVectorizeMaxColors(){return this.step.data.vectorizeMaxColors}getMinimumPixelThresholdForOptimization(){return this.step.data.vectorizationMinimumPixelThreshold}getMaxAllowedColors(){return this.step.data.maxColors}getUniqueColorCount(){return uo.getUniqueColorCount(this.step,this.manager)}getCurrentFrameStep(e,t,n,i){return i&&i.length>1&&e===void 0?"SelectFrame":t||n||this.getImageData()?"Position":"SelectImage"}getFrameService(){return this.frameService}hasOverlayImageKey(){return this.step.data.overlayImageKey}hasOverlayImageUrl(){return this.step.data.overlayImageUrl}getWhitelistedExtensions(){return[...this.step.data.whitelistedExtensions,...this.step.data.whitelistedExtensions.includes(".jpg")?[".jpeg"]:[]]}async getOriginalImageSelection(){const e=this.getFrameStepStorage()?.framePatternData?.originalAssetKey;if(e)return Un.getLocalOrFromServer(e)}getCurrentImageState(){const e=this.getFrameStepStorage()?.framePatternData;return e?e.vectorizedAssetKey&&!e.useOriginalAsset?"optimized":e.useOriginalAsset!==!1?"original":"backgroundRemoved":"original"}async setImageState(e){const t=this.getFrameStepStorage()?.framePatternData||{};let n,i;switch(e){case"original":if(n=await this.getOriginalImageSelection(),!n)throw new Error("No original image available");i=!0;break;case"backgroundRemoved":if(n=await this.getBackgroundRemovedImageSelection(),!n)throw new Error("No background-removed image available. Call removeBackgroundFromImageSelection first.");i=!1;break;case"optimized":if(n=await this.getVectorizedImageSelection(),!n)throw new Error("No optimized image available. Call vectorize first.");i=!1;break}await this.selectImage(n,!1,!0),this.manager.updateStorage(this.step.stepName,{framePatternData:{...t,useOriginalAsset:i}})}getUseOriginalImageSelection(){return this.getFrameStepStorage()?.framePatternData?.useOriginalAsset??!1}async setUseOriginalImageSelection(e){const t=this.getFrameStepStorage()?.framePatternData||{};if(t.useOriginalAsset===e)return;const n=await this.getOriginalImageSelection();if(!n)throw new Error("You must provide an image selection before calling setUseOriginalImageSelection");if(e)await this.selectImage(n,!1,!1);else{const i=await this.getBackgroundRemovedImageSelection();if(!i)throw new Error("You must call removeBackgroundFromImageSelection before attempting to apply the image.");await this.selectImage(i,!1,!1)}this.manager.updateStorage(this.step.stepName,{framePatternData:{...t,useOriginalAsset:e}})}getFrameStepStorage(){return this.manager.getStepStorage(this.step.stepName)}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}const TY=Ce`
|
|
3092
|
+
`;class gY{constructor(e){this.resource=e}getId(){return this.resource.id}getName(){return this.resource.name}getCreatedDate(){return new Date(this.resource.createdAt)}getUpdatedDate(){return new Date(this.resource.updatedAt)}getGlobalPropertyConfiguration(){return{id:this.resource.globalPropertyConfiguration.id,name:this.resource.globalPropertyConfiguration.name}}async applyToBundle(e){const n=(await Le.getShadowGraphqlClient().query({query:D9,variables:{ids:[this.resource.globalPropertyConfiguration.id]}})).data.globalPropertyConfigurations[0];await e.setGlobalPropertyConfiguration(n),await e.applyGlobalPropertyState({aspects:this.resource.aspectValues??[]})}}const mY=async(r,e)=>{const t=gM(e?.assets?.metadata||!1),n={ids:r};console.log("[getWorkflowsInternal] Requesting workflows.",{url:`${ls.getServerUrl()}/graphql`,variables:JSON.stringify(n)}),console.log(`[getWorkflowsInternal] Query:
|
|
3093
|
+
${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:"all",variables:n,context:{logRequestHeaders:!0}});if(i.error)throw console.log("[getWorkflowsInternal] Response errored."),i.error;if(i.errors)throw i.errors.forEach(s=>console.error(s)),new Error("Unable to read workflows. Consult GraphQL errors.");if(!i.data.workflows||i.data.workflows.length!==r.length)throw new Error(`Unable to read workflows: ${i.errors??"Length mismatch in response"}`);const a=Ao(i.data.workflows);return a.forEach(s=>{s.finalizeStepConfig||(s.finalizeStepConfig={}),s.finalizeStepConfig.termsMarkdown=s.finalizeStepConfig.termsMarkdown||s.partner.termsMarkdown}),a},yY=async(r,e)=>{const n=(await e).find(i=>i.id===r);if(!n)throw new Error(`Workflow not found: ${r}`);return n},fw=async(r,e)=>{const t=r.map(o=>Af.get({id:o,options:e})),n=r.filter((o,l)=>t[l]===void 0);if(n.length===0)return Promise.all(t);const i=mY(n,e),a=n.map(o=>Af.set({id:o,options:e},yY(o,i))),s=t.filter(o=>o!==void 0);return await Promise.all(s.concat(a))},sD=async(r,e)=>(await fw([r],e))[0],oD=async r=>{const e=await Le.getShadowGraphqlClient().query({query:PT,variables:{ids:r},errorPolicy:"all",fetchPolicy:"no-cache"});return e.errors&&console.error(e.errors),e.data.integrationProducts||[]};class vY{constructor(e){this.activeIntegration=void 0,this.updateTransactionState=async t=>{try{return Le.getShadowGraphqlClient().mutate({...t,mutation:eM})}catch(n){throw console.error(n),new fo("Critical - Unable to synchronize workflow state with server.")}},this.options=e,this.options.applicationKey&&oT(this.options.applicationKey),console.debug("------------------------"),console.debug("Spiff Commerce Core SDK"),console.debug("Version: 44.7.2-alpha.0"),console.debug(`Application Key Provided: ${!!this.options.applicationKey}`),console.debug("------------------------")}configure(e){ls.setHubUrl(e.hubUrl),ls.setServerUrl(e.serverUrl),ls.setServicesApiUrl(e.servicesApiUrl),this.marketplaceThemeInstallId=e.marketplaceThemeInstallId,this.marketplaceThemeInstallConfigurationId=e.marketplaceThemeInstallConfigurationId,this.userPoolClientId=e.userPoolClientId,this.userPoolRegion=e.userPoolRegion,this.spiffRegion=e.spiffRegion,e.bearerAuthenticationToken&&uT(e.bearerAuthenticationToken),this.options.applicationKey&&this.getIntegration(),this.spiffRegion&&this.userPoolRegion&&this.userPoolClientId&&Dd.init(this.spiffRegion,this.userPoolRegion,this.userPoolClientId)}getVersion(){return"44.7.2-alpha.0"}getAssetManager(){return Un}async getBetaEnabled(){return this.options.enableBetaFeatures?!0:(await this.getIntegration()).partner.beta===!0}getFlowService(){if(!bB())throw new Error("Application key required to use Flow Service.");return new nP}async getCurrencyContext(e){const n=(await this.getIntegration()).partner.currencyCode,a=await Le.getShadowGraphqlClient().query({query:wM,errorPolicy:"all",fetchPolicy:"cache-first",variables:{from:n,to:e}}),{rateFrom:s,rateTo:o}=a.data.currencyConversion;return new aD(s,o,n,e)}async getIntegration(){if(this.activeIntegration)return this.activeIntegration;if(!this.options.applicationKey)throw new Error("Cannot get current Integration without specifying an Application Key.");return this.activeIntegration=lD(this.options.applicationKey),this.activeIntegration}async canUseAddon(e){try{return(await this.getIntegration()).partner.activeAddons?.includes(e)??!1}catch(t){return console.error(t),!1}}clearCustomer(){this.customer=void 0}clearCustomerForTransaction(e){const t=wr.getMap("transactionCustomerIds");t?.has(e)&&(t.delete(e),wr.setMap("transactionCustomerIds",t))}async customerHasBundleTemplates(e){const i=(await Le.getShadowGraphqlClient().query({query:Ly,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;return i.id?i.hasBundleTemplates??!1:!1}getStakeholderTypeForTransaction(e){const t=this.customer?.stakeholders?.find(n=>n.transaction?.id===e);if(t)return t.type}async getOrCreateCustomer(e){this.customer=void 0;const t=Le.getShadowGraphqlClient(),i=(await t.query({query:Ly,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e}})).data.customer;if(!i.id){const o=(await t.mutate({mutation:YV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{details:{emailAddress:e}}})).data?.customerCreate;if(!o)throw new Error("Unable to create customer.");return this.storeCustomer(o),this.customer=o,{customer:o,isAuthenticated:!1}}this.storeCustomer(i);const a=await this.reloadLoggedInCustomer();return{customer:this.customer||i,isAuthenticated:a}}getCustomer(){return this.customer}async reloadLoggedInCustomer(){const e=localStorage.getItem("last-refreshed-cognito-tokens"),t=localStorage.getItem("cognito-tokens"),n=localStorage.getItem("cognito-email");if(!e||!t||!n)return!1;const i=JSON.parse(t),a=new Date().getTime()/1e3;if(!i.ExpiresIn||i.ExpiresIn<a-parseInt(e)){const u=await Dd.refreshTokens();if(u?.AuthenticationResult)localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),i.AccessToken=u.AuthenticationResult.AccessToken,localStorage.setItem("cognito-tokens",JSON.stringify(i));else return this.logOut(),console.error("Failed to refresh tokens."),!1}const s=localStorage.getItem("customer-login-token");s&&A0(s);const l=(await Le.getShadowGraphqlClient().query({query:Ly,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:n}})).data.customer;return l.id?(this.customer=l,!0):(console.error("Failed to get customer."),!1)}async generateVerificationCode(e){await Le.getShadowGraphqlClient().mutate({mutation:XV,variables:{emailAddress:e}}),await Dd.generateCode(e)}async verifyCode(e,t){const n=(await this.getIntegration()).partner.id||"",i=await Dd.verifyCode(e,t,n);if(i?.AuthenticationResult){localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),localStorage.setItem("cognito-tokens",JSON.stringify(i.AuthenticationResult)),localStorage.setItem("cognito-email",e);const s=(await Le.getShadowGraphqlClient().mutate({mutation:JV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{emailAddress:e,verificationCode:t}})).data?.customerVerifyCode;if(!s?.id)throw new Error("Failed to get customer.");return this.customer=s,s.loginToken&&(localStorage.setItem("customer-login-token",s.loginToken),A0(s.loginToken)),!0}else throw new Error}async logOut(){localStorage.removeItem("last-refreshed-cognito-tokens"),localStorage.removeItem("cognito-tokens"),localStorage.removeItem("cognito-email"),localStorage.removeItem("customer-login-token"),A0(""),this.clearCustomer()}async loggedInBearerToken(){const e=localStorage.getItem("last-refreshed-cognito-tokens"),t=localStorage.getItem("cognito-tokens");if(!e||!t)throw new Error("No token data in storage.");const n=JSON.parse(t),i=new Date().getTime()/1e3,a=!n?.AccessToken||xg(n.AccessToken);if(!n.ExpiresIn||n.ExpiresIn<i-parseInt(e)||a){const s=await Dd.refreshTokens();if(s?.AuthenticationResult)localStorage.setItem("last-refreshed-cognito-tokens",`${new Date().getTime()/1e3}`),n.AccessToken=s.AuthenticationResult.AccessToken,localStorage.setItem("cognito-tokens",JSON.stringify(n));else throw this.logOut(),new Error("Failed to refresh tokens.")}if(!n.AccessToken)throw new Error("No bearer token in storage.");return n.AccessToken}async getCustomerMetafields(){if(!this.customer?.id)throw new Error("Customer must be logged in before calling this function.");return(await Le.getShadowGraphqlClient().query({query:KV,variables:{id:this.customer.id}})).data.metafields}async getNewBundle(e,t,n,i){const s=(await Le.getShadowGraphqlClient().mutate({mutation:_9(n?.graphql?.productCollection?.eagerFetchProducts||!1),variables:{collectionId:e,initialMetadata:t?Object.entries(t).map((c,f)=>({key:c[0],value:c[1]})):void 0,marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId,activationId:i,test:n?.test},fetchPolicy:"no-cache"})).data?.bundleCreate;if(!s?.id)throw new Error("Unable to create bundle");const o=wr.getMap("bundlePartnerIds")||new Map;o.set(s.id,s.partner.id),wr.setMap("bundlePartnerIds",o);const l=wr.getMap("bundleOwnerIds")||new Map;l.set(s.id,s.bundleOwnerId),wr.setMap("bundleOwnerIds",l);const u=new HE(this,s,void 0,void 0,s.bundleOwnerId,{eagerFetchProducts:n?.graphql?.productCollection?.eagerFetchProducts});return await u.getInitializationPromise(),u}async getExistingBundle(e,t,n,i,a){const o=wr.getMap("bundleOwnerIds")?.get(e),l={};try{const g=await this.loggedInBearerToken();l.Authorization=`Bearer ${g}`}catch{const v=Object.entries(localStorage).find(([x,S])=>x.startsWith("CognitoIdentityServiceProvider")&&x.endsWith("idToken"))?.[0]||"",A=localStorage.getItem(v);A&&!xg(A)&&(l.Authorization=`Bearer ${A}`)}const u={bundleOwnerId:o,...l,...i?.graphql?.additionalHeaders},c=await Le.getShadowGraphqlClient().query({query:R9(i?.graphql?.productCollection?.eagerFetchProducts||!1),variables:{id:e},fetchPolicy:"no-cache",context:{headers:u}});if(!c.data?.bundles||c.data?.bundles.length===0||!c.data?.bundles[0])throw new Error(`Unable to find bundle: ${e}`);const f=c.data?.bundles[0],d=wr.getMap("bundlePartnerIds")||new Map;d.set(f.id,f.partner.id),wr.setMap("bundlePartnerIds",d);const h=new HE(this,f,t,n,o,{additionalHeaders:i?.graphql?.additionalHeaders,eagerFetchProducts:i?.graphql?.productCollection?.eagerFetchProducts,existingGlobalPropertyState:c.data.globalPropertyState,readonly:i?.readonly},a);return await h.getInitializationPromise(),h}async duplicateBundle(e,t,n,i){const s={...await dD(e),...i?.graphql?.additionalHeaders},l=(await Le.getShadowGraphqlClient().mutate({mutation:N9(),variables:{id:e,template:t,marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId,duplicateTransactions:n,test:i?.test},context:{headers:s},fetchPolicy:"no-cache"})).data?.bundleDuplicate;if(!l?.id)throw new Error("Unable to duplicate bundle");const u=wr.getMap("bundlePartnerIds")||new Map;u.set(l.id,l.partner.id),wr.setMap("bundlePartnerIds",u);const c=wr.getMap("bundleOwnerIds")||new Map;return c.set(l.id,l.bundleOwnerId),wr.setMap("bundleOwnerIds",c),async()=>await this.getExistingBundle(l.id,void 0,void 0,{graphql:{productCollection:{eagerFetchProducts:i?.graphql?.productCollection?.eagerFetchProducts||!1}}})}async getBundlesForCustomer(e){if(!this.customer?.id)throw new Error("Customer not authenticated.");const{includeMetadata:t,...n}=e;return(await Le.getShadowGraphqlClient().query({query:Q9(t??!1),variables:{...n,id:this.customer.id},fetchPolicy:"no-cache"})).data.customerBundlesFeed}async getTemplatesForCustomer(e){if(!this.customer?.id)throw new Error("Customer not authenticated.");const t=await Le.getShadowGraphqlClient().query({query:pY,variables:{...e,id:this.customer.id},fetchPolicy:"no-cache"});return{total:t.data.globalPropertyTemplatesFeed.total,items:t.data.globalPropertyTemplatesFeed.items.map(n=>new gY(n))}}async getBundleStakeholders(){if(!this.customer)throw new Error("Customer not authenticated.");const e=await Le.getShadowGraphqlClient().query({query:O9,variables:{id:this.customer.id},fetchPolicy:"no-cache"});if(!e.data?.customers||e.data.customers.length===0)throw new Error("Unable to find customer.");const n=e.data.customers[0].bundleStakeholders||[],i=wr.getMap("bundlePartnerIds")||new Map;return n.forEach(a=>{a.bundle?.id&&a.bundle.partner?.id&&i.set(a.bundle.id,a.bundle.partner.id)}),wr.setMap("bundlePartnerIds",i),n}async getWorkflowExperience(e,t){if(!e)throw new Error("getWorkflowExperience has been called without an options object! This is not supported.");const n=await this.getWorkflowExperiences([e],e.graphql),i=n[0],a=i.getWorkflow();return t&&!a&&console.error("No workflow instantiated when trying to create preview service."),t&&a&&await i.getWorkflowManager().injectIntoPreviewService(t(a)),n[0]}async getWorkflowExperiences(e,t,n,i){if(e.length===0)throw new fo("No options provided!");const a=e.map((U,$)=>({option:U,index:$})),s=a.filter(U=>U.option.type==="transaction"),o=a.filter(U=>U.option.type==="integration"||U.option.type==="external"||U.option.type==="blank"),l=50,u=xA(s,l),c=xA(o,l);let f=0;const d=Le.getShadowGraphqlClient(),h=async U=>{if(U.length===0)return[];const $=U.map(K=>K.option.transactionId),z=await d.query({query:Z3,variables:{ids:$},errorPolicy:"all",fetchPolicy:"no-cache"}),Q=z.data.transactions;if(f=f+Q.length,i&&i(f,s.length),Q.length!==U.length){const K=z.errors?.[0]?.message||"Unknown error";throw new fo(`Not all transactions were found: ${K}`)}return!this.activeIntegration&&Q[0].integrationProduct?.integration&&(this.activeIntegration=Promise.resolve(Q[0].integrationProduct.integration)),Q.map((K,le)=>({transaction:K,workflowId:K.workflowId,readOnly:U.find(he=>he.option.transactionId===K.id)?.option.readOnly??!1,index:U[le].index}))},g=async U=>{if(U.length===0)return[];const $=await d.mutate({mutation:K3,variables:{inputs:U.map(Q=>({integrationProductId:Q.option.type==="integration"?Q.option.integrationProductId:void 0,externalIntegrationId:Q.option.type==="external"?Q.option.externalIntegrationId:void 0,externalProductId:Q.option.type==="external"?Q.option.externalProductId:void 0,workflowId:Q.option.workflowId,designName:Q.option.designName,claim:!0,quantity:Q.option.quantity,recipient:Q.option.recipient,parentTransactionId:Q.option.parentTransactionId})),marketplaceThemeInstallId:this.marketplaceThemeInstallId,marketplaceThemeInstallConfigurationId:this.marketplaceThemeInstallConfigurationId},errorPolicy:"all",fetchPolicy:"no-cache",context:this.getCreateTransactionContext(U,t)}),z=$.data?.transactionCreateMany;if(!z||z.length===0){const Q=$.errors?.[0]?.message||"Unknown error";throw new fo(`Failed to create transactions: ${Q}`)}return f=f+z.length,i&&i(f,s.length),z.map((Q,K)=>({transaction:Q,workflowId:Q.workflowId,readOnly:!1,index:U[K].index}))},y=(await Promise.all([...u.map(h),...c.map(g)])).flat();let v=[...new Set(y.map(U=>U.transaction.integrationProductId))].filter(U=>!!U);v=v.filter(U=>!!U);let A=[...new Set(y.map(U=>U.workflowId))].filter(U=>!!U);A=A.filter(U=>!!U);const[x,S]=await Promise.all([(async()=>v.length>0?await oD(v):[])(),(async()=>A.length>0?await fw(A,t):[])()]),F=new Map(x.map(U=>[U.id,U])),E=new Map(S.map(U=>[U.id,U])),R=y.map(async U=>{const{transaction:$,workflowId:z,readOnly:Q,index:K}=U,le=z?E.get(z):void 0,he=e[K];if($.integrationProductId){const ue=F.get($.integrationProductId);$.integrationProduct=ue,$.product=ue?.product,$.integrationProduct||console.error("failed to find transaction's product")}const Me=wr.getMap("transactionOwnerIds")||new Map;!Me.get($.id)&&$.transactionOwnerId&&(Me.set($.id,$.transactionOwnerId),wr.setMap("transactionOwnerIds",Me));const De=Me.get($.id)||void 0,Pe=new ZV({onMutate:()=>({context:{transactionOwnerId:De,bundleOwnerId:t?.bundleOwnerId}}),onQuery:()=>({context:{transactionOwnerId:De,bundleOwnerId:t?.bundleOwnerId}})}),re={workflow:le,transaction:$,singleVariantsRenderable:he?.workflowConfiguration?.singleVariantsRenderable,stateMutationFunc:Q?async()=>{throw new an("State mutation is forbidden in read only mode!")}:async ue=>this.updateTransactionState({...ue,context:{transactionOwnerId:De,bundleOwnerId:t?.bundleOwnerId}}),graphQlClient:()=>Pe,readOnly:Q,isReloadedTransaction:he.type==="transaction"};if(he.type==="transaction"&&$.workflowState){const ue=JSON.parse($.workflowState);await gA(ue),re.reloadedState=ue}else if(!Q&&he.workflowState){const ue=JSON.parse(he.workflowState);await gA(ue),re.reloadedState=ue}return re.delayWorkflowStateSync=!0,{experienceOptions:re,index:K,options:he}}),W=(await Promise.all(R)).sort((U,$)=>U.index-$.index);let Y=[],ae=[];for(const U of W){const{experienceOptions:$,options:z}=U,Q=new q1(this,$);await Q.getWorkflowManager().getInitializationPromise(),n&&n(),z.type!=="transaction"&&this.customer&&ae.push(Q),Y=[...Y,Q],Q.getWorkflowManager().setWorkflowStateSyncEnabled(!0)}if(ae.length>0){const U=this.customer.emailAddress,$=ae.map(K=>K.getTransaction().id),Q=(await d.mutate({mutation:CV,variables:{ids:$,details:{emailAddress:U},type:"Owner"},errorPolicy:"all"})).data?.transactionsAddStakeholder;if(Q&&Q?.length>0){const K=Q[0].stakeholders?.find(le=>le.customer?.emailAddress===U);if(K?.customer)for(const le of ae)le.assignCustomerInternal(K.customer)}}return Y}getCreateTransactionContext(e,t){const n=e.find(s=>s.option.parentTransactionId)?.option.parentTransactionId;if(!n&&!t?.bundleOwnerId)return;const i=wr.getMap("transactionOwnerIds")||new Map,a=n?i.get(n):void 0;return{...a?{transactionOwnerId:a}:{},...t?.bundleOwnerId?{bundleOwnerId:t.bundleOwnerId}:{}}}storeCustomer(e){const t=wr.getMap("partnerCustomerIds")||new Map;t.set(e.partner.id,e.id),wr.setMap("partnerCustomerIds",t)}async getIntegrationProductById(e,t){const a=(await Le.getShadowGraphqlClient().query({query:oM(t),variables:{ids:[e]},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.integrationProducts;if(!a||a.length===0||!a[0]?.id)throw new Error("Integration product not found.");return new EA(a[0])}async getIntegrationProductFromExternalIds(e,t,n){const s=(await Le.getShadowGraphqlClient().query({query:lM(n),variables:{externalProductId:t,externalIntegrationId:e},fetchPolicy:"no-cache",errorPolicy:"all"})).data?.integrationProductFromExternalIds;if(!s?.id)throw new Error("Integration product not found.");return new EA(s)}async getIntegrationProduct(e){return e.type==="integration"?this.getIntegrationProductById(e.integrationProductId):this.getIntegrationProductFromExternalIds(e.externalIntegrationId,e.externalProductId)}async getShareActionsForTransaction(e){const n=(wr.getMap("transactionOwnerIds")||new Map).get(e)||void 0,i=await Le.getShadowGraphqlClient().query({query:aM,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:e},context:{transactionOwnerId:n}});if(!i.data.transactions||i.data.transactions.length!==1)throw new Error(`Failed to fetch share actions for transaction: ${e}`);return i.data.transactions[0].transactionShareActions}async placeOrder(e){const t=await Le.getShadowGraphqlClient().mutate({mutation:bM,variables:{orderItems:e}});if(t.errors)throw new Error(t.errors[0].message);if(!t.data)throw new Error("Failed to create order: No order data in response.");return{id:t.data.orderCreate.id,internalId:t.data.orderCreate.internalId}}}const lD=async(r,e)=>(await Le.getShadowGraphqlClient().query({query:yM,errorPolicy:"all",fetchPolicy:"no-cache",context:{headers:{"x-application-key":r},skipIntegrationCheck:!0},variables:{themeConfigurationId:e}})).data.currentIntegration,AY=async r=>{const t=await Le.getShadowGraphqlClient().query({query:iM,errorPolicy:"all",fetchPolicy:"network-only",variables:{id:r}});if(t.data.transactions.length!==0)return t.data.transactions[0]},bY=async(r,e)=>(await Le.getShadowGraphqlClient().query({query:mM,errorPolicy:"all",variables:{themeConfigurationId:r,themeInstallId:e}})).data?.marketplaceThemeInstallConfiguration,wY=async r=>(await Le.getShadowGraphqlClient().query({query:AM,errorPolicy:"all",variables:{id:r}})).data?.bundles?.[0]?.marketplaceThemeInstallConfiguration,xY=async r=>(await Le.getShadowGraphqlClient().query({query:vM,errorPolicy:"all",variables:{id:r}})).data?.transactions?.[0]?.marketplaceThemeInstallConfiguration,uD=async(r,e)=>(await Le.getShadowGraphqlClient().query({query:FM(!!e),errorPolicy:"all",variables:{id:r,productIds:e}})).data?.activation,CY=async r=>(await uD(r))?.marketplaceThemeInstallConfiguration;async function cD(){const r={};try{const e=await this.loggedInBearerToken();r.Authorization=`Bearer ${e}`}catch{const n=Object.entries(localStorage).find(([a,s])=>a.startsWith("CognitoIdentityServiceProvider")&&a.endsWith("idToken"))?.[0]||"",i=localStorage.getItem(n);i&&!xg(i)&&(r.Authorization=`Bearer ${i}`)}return r}async function dD(r){const t=wr.getMap("bundleOwnerIds")?.get(r),n=await cD();return{bundleOwnerId:t,...n}}async function SY(r){const t=wr.getMap("transactionOwnerIds")?.get(r),n=await cD();return{transactionOwnerId:t,...n}}const EY=async r=>{const e=await dD(r),t=await Le.getShadowGraphqlClient().mutate({mutation:nV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r},context:{headers:e}});if(t.data?.bundleDelete!==r)throw new Error(`Failed to delete bundle: ${t.errors}`)},kY=async r=>{const e=await SY(r),t=await Le.getShadowGraphqlClient().mutate({mutation:iV,errorPolicy:"all",fetchPolicy:"no-cache",variables:{ids:[r]},context:{headers:e}});if(!t.data?.transactions||t.data.transactions.length!==1||t.data.transactions[0].id!==r)throw new Error(`Failed to find transaction to read bundle id: ${JSON.stringify(t.errors)}`);return t.data.transactions[0].bundle?.id};function fD(r,e,t,n){const i=t.width*r.zoom,a=t.height*r.zoom;if(n){const s=Math.max(e.width/t.width,e.height/t.height),o=Math.max(s,r.zoom),l=t.width*o,u=t.height*o;return{...r,x:Bp(r.x,e.width-l,0),y:Bp(r.y,e.height-u,0),zoom:o}}return{...r,x:Bp(r.x,-i,e.width),y:Bp(r.y,-a,e.height)}}function Bp(r,e,t){return Math.min(Math.max(r,e),t)}class hD{constructor(e,t){this.minZoomScale=[.03],this.maxZoomScale=[20],this._debouncedUpdateFrameOffsets=v1(this.updateFrameOffsets,200),this.targetElements=[],this.onFrameDataChangeListeners=[],this.onZoomChangeListeners=[],this.onRotationChangeListeners=[],this.forceImageCover=e,this.initialZoom=t,this.thresholdSettings={useThreshold:!1,invertThreshold:!1,threshold:128,thresholdSaturation:.5}}connectWorkflowManager(e,t){t&&e.addStepSpecificStorageCallback(async n=>{if(n){const i=n;if(i.currentFrameSources){let a=!1;for(let s=0;s<i.currentFrameSources.length;s++){const o=i.currentFrameSources[s],l=await Zf(o),u=this.frameData?this.frameData[s]:void 0;wf(l,u)||(this.frameData||(this.frameData=new Array(i.currentFrameSources.length)),this.frameData[s]=l,a=!0)}a&&(this.onFrameDataChangeListeners.forEach(s=>s(this.frameData)),this.frameData&&this.imageData&&(this.recalculateOffsets(this.imageData),this.updateOffsets(this.offsets),this.recalculateZoomLimits(this.imageData,this.frameData)))}}},t),this.workflowManager=e,this.stepName=t}setTargetElements(e){this.targetElements=e}getFrameData(){return this.frameData}setFrameData(e){if(!e){this.frameData=void 0;return}e.forEach((t,n)=>{const i=Uu.get(t);i&&(this.frameData||(this.frameData=new Array(e.length)),this.frameData[n]=i)})}getImageData(){return this.imageData}getImageSrc(){if(this.imageData){if(this.imageData.svg){const e=qg(this.imageData.svg,this.imageData.colors||{},!1);return Gg(e)}return this.imageData.src}}getOffsets(){return this.offsets}setOffsets(e){this.offsets=e}setZoom(e,t,n,i){if(this.imageData&&this.offsets&&this.frameData){(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length));const a=this.frameData.map((s,o)=>{const l=(t[o]-this.offsets[o].x)/this.offsets[o].zoom,u=(n[o]-this.offsets[o].y)/this.offsets[o].zoom,c=t[o]-l*e[o],f=n[o]-u*e[o];return{x:c,y:f,zoom:this.imageData.width*e[o]/this.imageData.width,rotation:this.offsets[o].rotation}});this.updateOffsets(a,i),this.onZoomChangeListeners.forEach(s=>s(e))}}setRotation(e,t){if(this.imageData&&this.offsets&&this.frameData){(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length));const n=this.frameData.map((i,a)=>({...this.offsets[a],rotation:e[a]}));this.updateOffsets(n,t),this.onRotationChangeListeners.forEach(i=>i(e))}}setPatternData(e,t=!0){this.imageData=e,e&&this.frameData&&((t||!this.offsets)&&this.recalculateOffsets(e,t),this.updateOffsets(this.offsets,void 0,!0)),this.imageData&&this.frameData&&this.recalculateZoomLimits(this.imageData,this.frameData)}updateOffsets(e,t,n){const i=this.imageData;if(!i||!this.frameData)return;if(this.frameData.length!==e.length)throw new an("Frame data and offsets are not the same length. This is a bug. Please report it.");if(!this.offsets.some((s,o)=>!(e[o].x===s.x&&e[o].y===s.y&&e[o].zoom===s.zoom&&e[o].rotation===s.rotation))&&!n){t&&t();return}(!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length)),this.frameData.forEach((s,o)=>{this.offsets[o]=fD(e[o],s,this.imageData,this.forceImageCover)}),this._debouncedUpdateFrameOffsets(this.offsets,i,this.frameData,this.thresholdSettings,t)}getThresholdSettings(){return this.thresholdSettings}setThresholdSettings(e){this.thresholdSettings=e,this.imageData&&this.frameData&&this._debouncedUpdateFrameOffsets(this.offsets,this.imageData,this.frameData,e)}onFrameDataChanged(e){e(this.frameData),this.onFrameDataChangeListeners.push(e)}onZoom(e){this.onZoomChangeListeners.push(e)}onRotation(e){this.onRotationChangeListeners.push(e)}updateFrameOffsets(e,t,n,i,a){if(!n||n.length===0||n.some(l=>!l))throw new an("Frame data not set. This is a bug");if(!this.workflowManager)throw new an("No workflow manager set, cannot update offsets.");const s=this.workflowManager.getRegionElements(this.stepName||""),o=this.workflowManager.getCommandDispatcher();this.targetElements.forEach((l,u)=>{let c=s.find(f=>f.id===l)?.regionIndex??u;c>=e.length&&(c=u);try{o(new In([new YL(l,t,e[c]),new XL(l,i.useThreshold,i.invertThreshold,i.threshold,i.thresholdSaturation)]))}catch{}}),this.stepName&&this.workflowManager.updateStorage(this.stepName,{frameOffsetsList:e}),a&&a()}recalculateZoomLimits(e,t){(this.minZoomScale.length!==t.length||this.maxZoomScale.length!==t.length)&&(this.minZoomScale=new Array(t.length),this.maxZoomScale=new Array(t.length)),t.forEach((n,i)=>{const a=Math.max(n.width/e.width,n.height/e.height);this.forceImageCover?(this.minZoomScale[i]=a,this.maxZoomScale[i]=a*2.5):(this.minZoomScale[i]=a/10,this.maxZoomScale[i]=a*2.5)})}recalculateOffsets(e,t=!0){this.frameData&&((!this.offsets||this.offsets.length!==this.frameData.length)&&(this.offsets=new Array(this.frameData.length)),this.frameData.forEach((n,i)=>{const a=t?0:this.offsets[i]?.rotation||0;this.offsets[i]={...O1(e,n,this.initialZoom&&!this.forceImageCover?{scale:this.initialZoom}:void 0,this.forceImageCover),rotation:a}}),this._debouncedUpdateFrameOffsets(this.offsets,e,this.frameData,this.thresholdSettings))}}class TY{traversableScenes(){throw new Error("Method not implemented.")}updateRecipient(e,t,n,i,a,s,o,l,u,c,f,d,h,g,y,v,A){throw new Error("Method not implemented.")}approveTransaction(e){throw new Error("Method not implemented.")}rejectTransaction(e){throw new Error("Method not implemented.")}getClient(){return this.client??{}}getWorkflowExperience(){return{}}setClient(e){this.client=e}getInitializationPromise(){return Promise.resolve()}async updateWorkflowConfiguration(e){throw new Error("Method not implemented.")}isInitialized(){return!0}getInformationResults(){return[]}async reset(){}updateStateWithServer(e){}async outstandingRequestsPromise(){}async updateStateWithServerImmediate(e){}addPoller(e){}addConfirmCallback(e){}addEditedCallback(e){}addElementsCallback(e){}addInformationResultCallback(e){}addInitCallback(e){}addMakingAdjustmentsCallback(e){}addMandatoryCallback(e){}addMetadataCallback(e){}addSelectionCallback(e){}addStepSpecificStorageCallback(e,t){}addStorageCallback(e){}getCommandDispatcher(){return e=>{}}getLayouts(){return[]}getLayoutPreviewService(){return{getAll:()=>new Map}}getPreviewService(){}getModelContainer(){}getRegionElements(e){return[]}getSerializedStep(e,t){}getStepSpecificServices(e){}getTransaction(){return{id:""}}getTransactionCustomer(){}setTransactionCustomer(){}setTransactionCustomerDetails(){}getInitialOptionIds(){return new Promise(()=>new Set)}getWorkflow(){return{id:"",name:"",panels:[],steps:[],showModelOnFinishStep:!1,allowProofDownload:!1,introduction:"",stepGroups:[]}}markStepsAsInitialised(e){}markUpdateCompleted(e){}markUpdatePending(){return"123"}getWorkflowSelections(){return{}}getStepSelections(){return{}}setCurrentAdjustingStepId(e){}setEditedStatus(e,t){}setInformationResults(e){}setMandatoryFulfilled(e,t){}async setSelectionsAndElements(e,t,n){}toggleDesignConfirmed(){}updateMetadata(e,t){}async updateStorage(e,t){}injectIntoPreviewService(e){return Promise.resolve()}ejectFromPreviewService(){}setWorkflowStateSyncEnabled(e){}async updateTransactionShareActions(){}addValidationCallback(e){}setStepError(e,t,n){}getStepErrors(e){}getValidationErrors(){return{steps:new Map}}async updateTransactionStakeholders(){}getStepTags(e){return[]}}var pD=(r=>(r.SelectFrame="SelectFrame",r.SelectImage="SelectImage",r.Position="Position",r))(pD||{}),gD=(r=>(r.Original="original",r.BackgroundRemoved="backgroundRemoved",r.Optimized="optimized",r))(gD||{});class mD extends $i{constructor(e,t,n){super(e,t,n);const i=t.data;this.frameService=new hD(i.forceImageCover,i.initialZoomLevel),this.frameService.connectWorkflowManager(e,t.stepName)}selectVariant(e){const t=this.manager.getRegionElements(this.step.stepName);return uo.selectVariant(this.step,e.getResource(),t,this.manager,n=>this.setUpdateState(n))}onFrameDataChanged(e){this.frameService&&this.frameService.onFrameDataChanged(t=>{t&&e(t)})}async selectImage(e,t=!0,n=!0){await uo.selectImage(this.step,e,this.manager,n),t&&this.manager.updateStorage(this.step.stepName,{framePatternData:{originalAssetKey:e.key,backgroundRemovedAssetKey:void 0,vectorizedAssetKey:void 0,enhancedAssetKey:void 0,useOriginalAsset:void 0}})}async canUseAdvancedImageManipulation(){return this.manager.getClient().canUseAddon(Ug.AdvancedImageManipulation)}async canRemoveBackground(){return await this.canUseAdvancedImageManipulation()&&this.hasOriginalImageSelection()&&!!this.frameService?.getImageData()?.src&&!this.frameService?.getImageData()?.svg}async removeBackgroundFromImageSelection(e=!0){if(!await this.canUseAdvancedImageManipulation())throw new Error("The current Integration does not have access to the Background Remover. Please call canUseAdvancedImageManipulation to ensure you disable this feature when appropriate.");const t=await this.getOriginalImageSelection();if(!t)throw new Error("You must supply an image selection before attempting to remove the background.");const n=await Un.removeBackgroundFromAsset(t);e&&await uo.selectImage(this.step,n,this.manager,!1);const i=this.getFrameStepStorage()?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...i,backgroundRemovedAssetKey:n.key,useOriginalAsset:!e}}),n}async vectorize(e,t=void 0){const n=e??await this.getOriginalImageSelection();if(!n)throw new Error("You must supply an image selection before attempting to vectorize the image.");const i=await Un.vectorizeAsset(n,t);await this.selectImage(i,!1);const a=this.getFrameStepStorage()?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{...a,vectorizedAssetKey:i.key,useOriginalAsset:!1}}),i}async enhanceWithAI(e,t){const n=e??await this.getOriginalImageSelection();if(!n)throw new Error("You must supply an image selection before attempting to enhance the image with AI.");const i=await Un.enhanceWithAI(n,t);await this.selectImage(i,!1);const a=this.getFrameStepStorage()?.framePatternData||{};return this.manager.updateStorage(this.step.stepName,{framePatternData:{originalAssetKey:a.originalAssetKey,backgroundRemovedAssetKey:a.backgroundRemovedAssetKey,vectorizedAssetKey:a.vectorizedAssetKey,enhancedAssetKey:i.key,useOriginalAsset:!1}}),i}async getBackgroundRemovedImageSelection(){const e=this.getFrameStepStorage()?.framePatternData?.backgroundRemovedAssetKey;if(e)return Un.getLocalOrFromServer(e)}async getVectorizedImageSelection(){const e=this.getFrameStepStorage()?.framePatternData?.vectorizedAssetKey;if(e)return Un.getLocalOrFromServer(e)}async getEnhancedImageSelection(){const e=this.getFrameStepStorage()?.framePatternData?.enhancedAssetKey;if(e)return Un.getLocalOrFromServer(e)}hasOriginalImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.originalAssetKey}hasBackgroundRemovedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.backgroundRemovedAssetKey}hasVectorizedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.vectorizedAssetKey}hasEnhancedImageSelection(){return!!this.getFrameStepStorage()?.framePatternData?.enhancedAssetKey}async changeColors(e){await uo.changeColors(this.step,this.manager,e)}getImageData(){if(this.frameService)return this.frameService.getImageData()}async getColorOption(){return await ct.ensureFullOption(this.step.data.colorOption)}getAvailableColors(){return this.step.data.colorPickerEnabled?uo.availableColors(this.step,this.manager):Promise.resolve([])}isColorPickerEnabled(){return this.step.data.colorPickerEnabled??!1}async getOriginalImageColors(){const e=this.getImageData();return e?.svg?(await Ra(e.svg)).colors:void 0}async mergeColors(e,t,n){const i=this.frameService.getImageData();if(!i?.svg||!i.colors)throw new Error("Cannot merge colors on non-SVG image or image without color information");const{svg:a,colors:s}=ST(i.svg,i.colors,e,t,n);this.frameService.setPatternData({...i,svg:a,colors:s},!1),this.manager.updateStorage(this.step.stepName,{colors:s})}async unmergeColors(e,t,n,i){const a=this.frameService.getImageData();if(!a?.svg||!a.colors)throw new Error("Cannot unmerge colors on non-SVG image or image without color information");this.frameService.setPatternData({...a,svg:i,colors:n},!1),this.manager.updateStorage(this.step.stepName,{colors:n})}getShouldVectorize(){return this.step.data.shouldVectorize??!1}getVectorizeMaxColors(){return this.step.data.vectorizeMaxColors}getMinimumPixelThresholdForOptimization(){return this.step.data.vectorizationMinimumPixelThreshold}getMaxAllowedColors(){return this.step.data.maxColors}getUniqueColorCount(){return uo.getUniqueColorCount(this.step,this.manager)}getCurrentFrameStep(e,t,n,i){return i&&i.length>1&&e===void 0?"SelectFrame":t||n||this.getImageData()?"Position":"SelectImage"}getFrameService(){return this.frameService}hasOverlayImageKey(){return this.step.data.overlayImageKey}hasOverlayImageUrl(){return this.step.data.overlayImageUrl}getWhitelistedExtensions(){return[...this.step.data.whitelistedExtensions,...this.step.data.whitelistedExtensions.includes(".jpg")?[".jpeg"]:[]]}async getOriginalImageSelection(){const e=this.getFrameStepStorage()?.framePatternData?.originalAssetKey;if(e)return Un.getLocalOrFromServer(e)}getCurrentImageState(){const e=this.getFrameStepStorage()?.framePatternData;return e?e.vectorizedAssetKey&&!e.useOriginalAsset?"optimized":e.useOriginalAsset!==!1?"original":"backgroundRemoved":"original"}async setImageState(e){const t=this.getFrameStepStorage()?.framePatternData||{};let n,i;switch(e){case"original":if(n=await this.getOriginalImageSelection(),!n)throw new Error("No original image available");i=!0;break;case"backgroundRemoved":if(n=await this.getBackgroundRemovedImageSelection(),!n)throw new Error("No background-removed image available. Call removeBackgroundFromImageSelection first.");i=!1;break;case"optimized":if(n=await this.getVectorizedImageSelection(),!n)throw new Error("No optimized image available. Call vectorize first.");i=!1;break}await this.selectImage(n,!1,!0),this.manager.updateStorage(this.step.stepName,{framePatternData:{...t,useOriginalAsset:i}})}getUseOriginalImageSelection(){return this.getFrameStepStorage()?.framePatternData?.useOriginalAsset??!1}async setUseOriginalImageSelection(e){const t=this.getFrameStepStorage()?.framePatternData||{};if(t.useOriginalAsset===e)return;const n=await this.getOriginalImageSelection();if(!n)throw new Error("You must provide an image selection before calling setUseOriginalImageSelection");if(e)await this.selectImage(n,!1,!1);else{const i=await this.getBackgroundRemovedImageSelection();if(!i)throw new Error("You must call removeBackgroundFromImageSelection before attempting to apply the image.");await this.selectImage(i,!1,!1)}this.manager.updateStorage(this.step.stepName,{framePatternData:{...t,useOriginalAsset:e}})}getFrameStepStorage(){return this.manager.getStepStorage(this.step.stepName)}isVariantCategoriesEnabled(){return this.step.data.enableVariantCategories??!1}}const FY=Ce`
|
|
3091
3094
|
query GetLoggedInCustomer($email: String!) {
|
|
3092
3095
|
customer(emailAddress: $email) {
|
|
3093
3096
|
id
|
|
@@ -3131,21 +3134,21 @@ ${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:
|
|
|
3131
3134
|
total
|
|
3132
3135
|
}
|
|
3133
3136
|
}
|
|
3134
|
-
`,
|
|
3137
|
+
`,IY=Ce`
|
|
3135
3138
|
mutation SetTransactionDesignName($id: String!, $name: String!) {
|
|
3136
3139
|
transactionUpdate(id: $id, designName: $name) {
|
|
3137
3140
|
id
|
|
3138
3141
|
designName
|
|
3139
3142
|
}
|
|
3140
3143
|
}
|
|
3141
|
-
`,
|
|
3144
|
+
`,PY=Ce`
|
|
3142
3145
|
mutation DuplicateTransaction($id: String!, $template: Boolean!) {
|
|
3143
3146
|
transactionDuplicate(id: $id, template: $template) {
|
|
3144
3147
|
id
|
|
3145
3148
|
workflowViewerLink
|
|
3146
3149
|
}
|
|
3147
3150
|
}
|
|
3148
|
-
`,
|
|
3151
|
+
`,DY=Ce`
|
|
3149
3152
|
query GetCustomerBundles($id: String!, $limit: Int!, $offset: Int!) {
|
|
3150
3153
|
customerBundlesFeed(id: $id, limit: $limit, offset: $offset) {
|
|
3151
3154
|
items {
|
|
@@ -3160,7 +3163,7 @@ ${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:
|
|
|
3160
3163
|
total
|
|
3161
3164
|
}
|
|
3162
3165
|
}
|
|
3163
|
-
`,
|
|
3166
|
+
`,RY=Ce`
|
|
3164
3167
|
query GetTransactionsForBundle($id: String!) {
|
|
3165
3168
|
bundles(ids: [$id]) {
|
|
3166
3169
|
id
|
|
@@ -3184,14 +3187,14 @@ ${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:
|
|
|
3184
3187
|
}
|
|
3185
3188
|
}
|
|
3186
3189
|
}
|
|
3187
|
-
`,
|
|
3190
|
+
`,OY=Ce`
|
|
3188
3191
|
mutation SetBundleName($id: String!, $name: String!) {
|
|
3189
3192
|
bundleUpdate(id: $id, name: $name) {
|
|
3190
3193
|
id
|
|
3191
3194
|
name
|
|
3192
3195
|
}
|
|
3193
3196
|
}
|
|
3194
|
-
`,
|
|
3197
|
+
`,BY=Ce`
|
|
3195
3198
|
mutation DuplicateBundle($id: String!, $template: Boolean!, $test: Boolean) {
|
|
3196
3199
|
bundleDuplicate(id: $id, template: $template, test: $test) {
|
|
3197
3200
|
id
|
|
@@ -3199,7 +3202,7 @@ ${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:
|
|
|
3199
3202
|
workflowViewerLink
|
|
3200
3203
|
}
|
|
3201
3204
|
}
|
|
3202
|
-
`,
|
|
3205
|
+
`,MY=Ce`
|
|
3203
3206
|
query GetBundleTemplates($id: String!, $limit: Int!, $offset: Int!) {
|
|
3204
3207
|
customerBundlesFeed(id: $id, limit: $limit, offset: $offset, template: true) {
|
|
3205
3208
|
items {
|
|
@@ -3212,7 +3215,7 @@ ${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:
|
|
|
3212
3215
|
total
|
|
3213
3216
|
}
|
|
3214
3217
|
}
|
|
3215
|
-
`,
|
|
3218
|
+
`,_Y=async(r,e,t)=>await Le.getShadowGraphqlClient().mutate({mutation:OY,errorPolicy:"all",variables:{id:r,name:e},context:t}),NY=async(r,e)=>await Le.getShadowGraphqlClient().mutate({mutation:IY,errorPolicy:"all",variables:{id:r,name:e}}),LY=async(r,e,t)=>await Le.getShadowGraphqlClient().mutate({mutation:BY,errorPolicy:"all",variables:{id:r,template:e,test:t}}),UY=async(r,e)=>await Le.getShadowGraphqlClient().mutate({mutation:PY,errorPolicy:"all",variables:{id:r,template:e}}),VY=async r=>(await Le.getShadowGraphqlClient().query({query:FY,errorPolicy:"all",variables:{email:r}})).data.customer,$Y=async(r,e,t)=>await Le.getShadowGraphqlClient().query({query:DY,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r,offset:t,limit:e}}),zY=async(r,e)=>await Le.getShadowGraphqlClient().query({query:RY,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r},context:e}),HY=async(r,e,t)=>(await Le.getShadowGraphqlClient().query({query:hw,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r,quicksearch:"",filters:{link:"and",status:{operator:"isAnyOf",values:["Created","DesignCompleted","ExternallyOrdered"]},template:{value:"false"}},offset:t,limit:e}}))?.data.customerTransactionsFeed?.items||[],GY=async(r,e,t)=>(await Le.getShadowGraphqlClient().query({query:hw,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r,quicksearch:"",filters:{link:"and",status:{operator:"equals",value:"Ordered"},template:{value:"false"}},offset:t,limit:e}}))?.data.customerTransactionsFeed?.items||[],jY=async(r,e,t)=>(await Le.getShadowGraphqlClient().query({query:hw,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r,quicksearch:"",filters:{link:"and",template:{value:"true"}},offset:t,limit:e}}))?.data.customerTransactionsFeed?.items||[],qY=async(r,e,t)=>(await Le.getShadowGraphqlClient().query({query:MY,errorPolicy:"all",fetchPolicy:"no-cache",variables:{id:r,offset:t,limit:e}}))?.data.customerBundlesFeed?.items||[],yD=Ce`
|
|
3216
3219
|
fragment AddressValidationResultFields on AddressValidationResult {
|
|
3217
3220
|
addressComplete
|
|
3218
3221
|
address {
|
|
@@ -3246,14 +3249,14 @@ ${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:
|
|
|
3246
3249
|
...AddressValidationResultFields
|
|
3247
3250
|
}
|
|
3248
3251
|
}
|
|
3249
|
-
`,
|
|
3252
|
+
`,WY=Ce`
|
|
3250
3253
|
${pw}
|
|
3251
3254
|
query GetAddressValidationJobs($ids: [String!]!) {
|
|
3252
3255
|
addressValidationJobs(ids: $ids) {
|
|
3253
3256
|
...AddressValidationJobFields
|
|
3254
3257
|
}
|
|
3255
3258
|
}
|
|
3256
|
-
`,
|
|
3259
|
+
`,QY=Ce`
|
|
3257
3260
|
${pw}
|
|
3258
3261
|
query GetRecipientsWithAddressValidationJobs($ids: [String!]!) {
|
|
3259
3262
|
recipients(ids: $ids) {
|
|
@@ -3263,33 +3266,33 @@ ${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:
|
|
|
3263
3266
|
}
|
|
3264
3267
|
}
|
|
3265
3268
|
}
|
|
3266
|
-
`,
|
|
3269
|
+
`,YY=Ce`
|
|
3267
3270
|
${yD}
|
|
3268
3271
|
mutation ValidateRecipientAddress($id: String!) {
|
|
3269
3272
|
recipientValidate(id: $id) {
|
|
3270
3273
|
...AddressValidationResultFields
|
|
3271
3274
|
}
|
|
3272
3275
|
}
|
|
3273
|
-
`,
|
|
3276
|
+
`,XY=Ce`
|
|
3274
3277
|
${pw}
|
|
3275
3278
|
mutation BatchValidateRecipientAddress($ids: [String!]!) {
|
|
3276
3279
|
recipientValidateBatch(ids: $ids) {
|
|
3277
3280
|
...AddressValidationJobFields
|
|
3278
3281
|
}
|
|
3279
3282
|
}
|
|
3280
|
-
`,
|
|
3283
|
+
`,JY=Ce`
|
|
3281
3284
|
mutation OverrideRecipientAddress($id: String!) {
|
|
3282
3285
|
recipientOverrideAddress(id: $id) {
|
|
3283
3286
|
id
|
|
3284
3287
|
}
|
|
3285
3288
|
}
|
|
3286
|
-
`,
|
|
3289
|
+
`,KY=Ce`
|
|
3287
3290
|
mutation SkipRecipientAddress($id: String!) {
|
|
3288
3291
|
recipientSkipAddress(id: $id) {
|
|
3289
3292
|
id
|
|
3290
3293
|
}
|
|
3291
3294
|
}
|
|
3292
|
-
`;var vD=(r=>(r.Confirmed="Confirmed",r.Plausible="Plausible",r.Unlikely="Unlikely",r))(vD||{}),AD=(r=>(r.Created="Created",r.Processing="Processing",r.Completed="Completed",r.Failed="Failed",r.Cancelled="Cancelled",r))(AD||{});const
|
|
3295
|
+
`;var vD=(r=>(r.Confirmed="Confirmed",r.Plausible="Plausible",r.Unlikely="Unlikely",r))(vD||{}),AD=(r=>(r.Created="Created",r.Processing="Processing",r.Completed="Completed",r.Failed="Failed",r.Cancelled="Cancelled",r))(AD||{});const ZY=async r=>{const e=r.map(n=>n.getTransaction().recipient?.id).filter(n=>!!n),t=await Le.getShadowGraphqlClient().query({query:QY,errorPolicy:"all",fetchPolicy:"network-only",variables:{ids:e}});return r.map(n=>{const i=n.getTransaction().recipient?.id;if(i)return t.data?.recipients?.find(a=>a.id===i)?.addressValidationJob})},eX=async r=>(await Le.getShadowGraphqlClient().query({query:WY,errorPolicy:"all",fetchPolicy:"network-only",variables:{ids:r}})).data?.addressValidationJobs,tX=async r=>r.getTransaction().recipient?.id?(await Le.getShadowGraphqlClient().mutate({mutation:YY,errorPolicy:"all",fetchPolicy:"network-only",variables:{id:r.getTransaction().recipient.id}})).data?.recipientValidate:void 0,rX=async r=>{const e=r.map(n=>n.getTransaction().recipient?.id).filter(n=>!!n),t=await Le.getShadowGraphqlClient().mutate({mutation:XY,errorPolicy:"all",fetchPolicy:"network-only",variables:{ids:e}});return r.map(n=>{const i=n.getTransaction().recipient?.id;if(i)return t.data?.recipientValidateBatch?.find(a=>a.entityId===i)})},nX=async r=>{const e=r.getTransaction().recipient?.id;if(!e)return;(await Le.getShadowGraphqlClient().mutate({mutation:JY,errorPolicy:"all",fetchPolicy:"network-only",variables:{id:e}})).data?.recipientOverrideAddress?.id&&(r.getTransaction().addressValidationStatus=Lg.Overridden)},iX=async r=>{const e=r.getTransaction().recipient?.id;if(!e)return;(await Le.getShadowGraphqlClient().mutate({mutation:KY,errorPolicy:"all",fetchPolicy:"network-only",variables:{id:e}})).data?.recipientSkipAddress?.id&&(r.getTransaction().addressValidationStatus=Lg.Skipped)},aX=Ce`
|
|
3293
3296
|
query GetIntegrationProductsForIds($ids: [String!]!) {
|
|
3294
3297
|
integrationProducts(ids: $ids) {
|
|
3295
3298
|
id
|
|
@@ -3299,5 +3302,5 @@ ${X2(t)}`);const i=await Le.getShadowGraphqlClient().query({query:t,errorPolicy:
|
|
|
3299
3302
|
}
|
|
3300
3303
|
}
|
|
3301
3304
|
}
|
|
3302
|
-
`,
|
|
3303
|
-
//# sourceMappingURL=index-
|
|
3305
|
+
`,sX=async r=>(await Le.getShadowGraphqlClient().query({query:aX,variables:{ids:r}})).data.integrationProducts;function oX(r){return new q1({},{stateMutationFunc:(()=>Promise.resolve()),transaction:{id:"local-transaction",product:{modelUrl:r.modelUrl}},graphQlClient:{},workflow:r.workflow,reloadedState:r.reloadedState})}function lX(r){return Object.entries(r).map(([e,t])=>{const n=t.selectedVariants?.map(s=>({id:s.id,priceModifier:s.priceModifier}));let i;const a=Object.keys(t).length;if(n!==void 0&&a>1||n===void 0&&a>0){i={};const s=t;i={...i,color:s.color,customColor:s.customColor,defaultCleared:s.defaultCleared,inputText:s.inputText,text:s.text,customiseAllText:s.customiseAllText};const o=t;i={...i,framePatternSrc:o.framePatternAsset?AA(o.framePatternAsset):void 0,currentFrameSources:o.currentFrameSources,framePatternData:o.framePatternData},i={...i,transactionId:t.transactionId}}return{stepName:e,selectedVariants:n,storage:i}})}exports.AddonHandle=Ug;exports.AddressValidationJobStatus=AD;exports.AddressValidationResultConfirmationLevel=vD;exports.AddressValidationStatus=Lg;exports.ArrayInput=QV;exports.AspectType=Gn;exports.AssetNotFoundError=To;exports.AssetType=gf;exports.BringForwardCommand=tU;exports.BringToBackCommand=eU;exports.BringToFrontCommand=ZL;exports.BundleDesignCreationCartAddMode=Yk;exports.CanvasCommand=Pn;exports.CollectionProduct=Ou;exports.ColorOptionGlobalPropertyHandle=CA;exports.CommandContext=gI;exports.ConversionDataType=Kd;exports.CreateElementCommand=ai;exports.CreateLayoutCommand=_1;exports.CurrencyContext=aD;exports.CurrencyService=iD;exports.DeleteElementCommand=Oo;exports.DigitalContentStepHandle=WI;exports.FileUploadGlobalPropertyHandle=KI;exports.FlowExecutionNodeResult=Gd;exports.FlowExecutionResult=iP;exports.FlowService=nP;exports.FontAlignmentCommand=bI;exports.FontColorCommand=mA;exports.FontSizeCommand=AI;exports.FontSourceCommand=yA;exports.FrameService=hD;exports.FrameStep=pD;exports.FrameStepHandle=mD;exports.GlobalPropertyHandle=rm;exports.GroupCommand=In;exports.IllustrationStepHandle=UI;exports.ImageState=gD;exports.InformationMessageType=eh;exports.InformationStepHandle=qI;exports.IntegrationProduct=EA;exports.IntegrationType=Jk;exports.LayoutElementFactory=jL;exports.LayoutElementType=er;exports.LayoutNotFoundError=Ai;exports.LayoutRenderingPurpose=tc;exports.MaterialStepHandle=VI;exports.MisconfigurationError=os;exports.MockWorkflowManager=TY;exports.ModelStepHandle=$I;exports.ModuleStepHandle=QI;exports.MoveCommand=qL;exports.ObjectInput=X1;exports.ObjectInputType=aP;exports.OptionGlobalPropertyHandle=W1;exports.OptionNotFoundError=mf;exports.ParseError=Cl;exports.PictureStepHandle=zI;exports.ProductCameraRig=Kk;exports.ProductCollection=Q1;exports.ProductCollectionProductSortKey=rP;exports.ProductStepHandle=YI;exports.ProductWorkflow=co;exports.PromiseQueue=Xg;exports.QuestionStepHandle=HI;exports.QueueablePromise=Yg;exports.ResizeCommand=QL;exports.ResourceNotFoundError=pc;exports.RotateCommand=WL;exports.ScaleAxis=gi;exports.SendBackwardsCommand=rU;exports.ShapeStepHandle=GI;exports.ShareActionType=Xk;exports.SpiffCommerceClient=vY;exports.StakeholderType=t1;exports.StepAspectType=Qk;exports.StepHandle=$i;exports.StepType=Ye;exports.TextAlgorithm=Rl;exports.TextChangeCommand=wI;exports.TextGlobalPropertyHandle=ZI;exports.TextInput=WV;exports.TextStepHandle=jI;exports.UnhandledBehaviorError=an;exports.UnitOfMeasurement=Zk;exports.UpdateImageSourceCommand=JL;exports.Variant=Pa;exports.WorkflowExperienceEventType=Cg;exports.WorkflowExperienceImpl=q1;exports.__values=FD;exports.amtChannelsForAspect=eP;exports.assetConfigurationDeleteMutation=SM;exports.assetConfigurationUpdateMutation=CM;exports.assetConfigurationsQuery=xM;exports.assetService=Un;exports.browserColorToHex=bT;exports.bundleEmailMutation=aV;exports.cmPerPixel=C5;exports.createLocalWorkflowExperience=oX;exports.currentDirection=b5;exports.dataUrlFromExternalUrl=lB;exports.deleteBundle=EY;exports.designService=eg;exports.determineCorrectFontSizeAndLines=tf;exports.digitalContentStepService=L1;exports.domParser=ds;exports.duplicateBundle=LY;exports.duplicateTransaction=UY;exports.fetchAsString=ia;exports.findAngle=h5;exports.findElement=Vn;exports.findPmsColors=k3;exports.frameDataCache=Uu;exports.frameStepService=uo;exports.fromHex=hP;exports.fromUtf8=Pl;exports.generate=Ar;exports.generateCommands=RI;exports.generateSVGWithUnknownColors=Ra;exports.generateStateFromDesignInputSteps=S9;exports.getActivation=uD;exports.getActivationThemeConfiguration=CY;exports.getAddressValidationJobs=eX;exports.getAssetsForProductImagesQuery=EM;exports.getAttributesFromArrayBuffer=Vf;exports.getAxisAlignedBoundingBox=f5;exports.getBoundedOffsets=fD;exports.getBundleIdForTransaction=kY;exports.getBundleThemeConfiguration=wY;exports.getCustomer=VY;exports.getCustomerBundles=$Y;exports.getElementVertices=w5;exports.getFrameData=Zf;exports.getGlobalPropertyStateForBundle=F9;exports.getIntegration=lD;exports.getIntegrationProducts=sX;exports.getLayoutCanvasSize=MI;exports.getNEPoint=v5;exports.getNWPoint=y5;exports.getOrderedTransactions=GY;exports.getOverrideThemeConfiguration=bY;exports.getPointOfRotation=m5;exports.getProductCollections=$V;exports.getSEPoint=A5;exports.getSvgElement=Zg;exports.getTemplateBundles=qY;exports.getTemplateTransactions=jY;exports.getTransaction=AY;exports.getTransactionThemeConfiguration=xY;exports.getTransactionsForBundle=zY;exports.getTransformedAssetURL=Wg;exports.getTrueCoordinates=g5;exports.getUnorderedTransactions=HY;exports.getValidationJobsForWorkflowExperiences=ZY;exports.getWorkflow=sD;exports.getWorkflows=fw;exports.graphQlManager=Le;exports.illustrationStepService=ef;exports.isCloseToValue=p5;exports.loadFont=_l;exports.matchHexToPms=C3;exports.materialStepService=U1;exports.mergeColorClasses=ST;exports.metafieldManager=Sg;exports.mmPerPixel=x5;exports.modelStepService=V1;exports.modifySVGColors=qg;exports.moduleStepService=$1;exports.nameBundle=_Y;exports.nameTransaction=NY;exports.nonPotTexSupport=BI;exports.optionService=ct;exports.outlineFontsInSvg=eL;exports.overrideWorkflowExperienceRecipientAddress=nX;exports.patternImageDataCache=Os;exports.persistenceService=wr;exports.pictureStepService=z1;exports.pmsToRgb=x3;exports.promiseCache=Af;exports.questionStepService=H1;exports.registerFetchImplementation=nB;exports.registerWindowImplementation=rB;exports.rehydrateSerializedLayout=gA;exports.rgbToPms=AT;exports.rotateAroundPoint=zd;exports.sanitizeSvgTree=jg;exports.setApplicationKey=oT;exports.setBearerAuthenticationToken=uT;exports.setCanvasModule=n1;exports.shapeStepService=Vu;exports.shortenUrl=TI;exports.skipWorkflowExperienceRecipientAddress=iX;exports.spiffCoreConfiguration=ls;exports.stepAspectValuesToDesignInputSteps=C9;exports.stepSelectionsToSerializableSteps=lX;exports.svgColorValueToDefinition=Qv;exports.svgStringDimensions=M1;exports.svgToDataUrl=Gg;exports.textStepService=ri;exports.toHex=xo;exports.toUtf8=am;exports.toast=II;exports.validateWorkflowExperienceRecipient=tX;exports.validateWorkflowExperienceRecipients=rX;exports.xmlSerializer=Mo;
|
|
3306
|
+
//# sourceMappingURL=index-Bhi8tgte.cjs.map
|