@stacksjs/ai 0.63.0 → 0.63.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.js CHANGED
@@ -1,69 +1,13 @@
1
- // src/utils/client-bedrock.ts
2
- import {
3
- BedrockClient,
4
- CreateModelCustomizationJobCommand,
5
- GetModelCustomizationJobCommand,
6
- ListFoundationModelsCommand
7
- } from "@aws-sdk/client-bedrock";
8
- async function createModelCustomizationJob(param) {
9
- logger.debug(param);
10
- const command = new CreateModelCustomizationJobCommand(param);
11
- const res = await client.send(command);
12
- logger.debug("Successfully create model customization job");
13
- logger.debug(res);
14
- return res;
15
- }
16
- async function getModelCustomizationJob(params) {
17
- logger.debug(params);
18
- const command = new GetModelCustomizationJobCommand(params);
19
- const res = await client.send(command);
20
- logger.debug("Successfully get model customization job");
21
- logger.debug(res);
22
- return res;
23
- }
24
- async function listFoundationModels(params) {
25
- logger.debug(params);
26
- const command = new ListFoundationModelsCommand(params);
27
- const res = await client.send(command);
28
- logger.debug("Successfully list foundation models");
29
- logger.debug(res);
30
- return res;
31
- }
32
- var client = new BedrockClient({ region: process.env.REGION || "us-east-1" });
33
- var logger = console;
34
- // src/utils/client-bedrock-runtime.ts
35
- import {
36
- BedrockRuntimeClient,
37
- InvokeModelCommand,
38
- InvokeModelWithResponseStreamCommand
39
- } from "@aws-sdk/client-bedrock-runtime";
40
- async function invokeModel(params) {
41
- logger2.debug(params);
42
- const command = new InvokeModelCommand(params);
43
- const res = await client2.send(command);
44
- logger2.debug("Successfully invoke model");
45
- logger2.debug(res);
46
- return res;
47
- }
48
- async function invokeModelWithResponseStream(params) {
49
- logger2.debug(params);
50
- const command = new InvokeModelWithResponseStreamCommand(params);
51
- const res = await client2.send(command);
52
- logger2.debug("Successfully invoke model with response stream");
53
- logger2.debug(res);
54
- return res;
55
- }
56
- var client2 = new BedrockRuntimeClient({
57
- region: process.env.REGION || "us-east-1"
58
- });
59
- var logger2 = console;
60
- export {
61
- listFoundationModels,
62
- invokeModelWithResponseStream,
63
- invokeModel,
64
- getModelCustomizationJob,
65
- createModelCustomizationJob
66
- };
1
+ var sf=Object.create;var{getPrototypeOf:nf,defineProperty:en,getOwnPropertyNames:of}=Object;var af=Object.prototype.hasOwnProperty;var rn=(e,r,t)=>{t=e!=null?sf(nf(e)):{};const s=r||!e||!e.__esModule?en(t,"default",{value:e,enumerable:!0}):t;for(let n of of(e))if(!af.call(s,n))en(s,n,{get:()=>e[n],enumerable:!0});return s};var ff=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Os=ff((sr,Ns)=>{(function(e,r){typeof sr=="object"&&typeof Ns=="object"?Ns.exports=r():typeof define=="function"&&define.amd?define([],r):typeof sr=="object"?sr.bowser=r():e.bowser=r()})(sr,function(){return function(e){var r={};function t(s){if(r[s])return r[s].exports;var n=r[s]={i:s,l:!1,exports:{}};return e[s].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=e,t.c=r,t.d=function(s,n,i){t.o(s,n)||Object.defineProperty(s,n,{enumerable:!0,get:i})},t.r=function(s){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},t.t=function(s,n){if(1&n&&(s=t(s)),8&n)return s;if(4&n&&typeof s=="object"&&s&&s.__esModule)return s;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:s}),2&n&&typeof s!="string")for(var c in s)t.d(i,c,function(o){return s[o]}.bind(null,c));return i},t.n=function(s){var n=s&&s.__esModule?function(){return s.default}:function(){return s};return t.d(n,"a",n),n},t.o=function(s,n){return Object.prototype.hasOwnProperty.call(s,n)},t.p="",t(t.s=90)}({17:function(e,r,t){r.__esModule=!0,r.default=void 0;var s=t(18),n=function(){function i(){}return i.getFirstMatch=function(c,o){var a=o.match(c);return a&&a.length>0&&a[1]||""},i.getSecondMatch=function(c,o){var a=o.match(c);return a&&a.length>1&&a[2]||""},i.matchAndReturnConst=function(c,o,a){if(c.test(o))return a},i.getWindowsVersionName=function(c){switch(c){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},i.getMacOSVersionName=function(c){var o=c.split(".").splice(0,2).map(function(a){return parseInt(a,10)||0});if(o.push(0),o[0]===10)switch(o[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},i.getAndroidVersionName=function(c){var o=c.split(".").splice(0,2).map(function(a){return parseInt(a,10)||0});if(o.push(0),!(o[0]===1&&o[1]<5))return o[0]===1&&o[1]<6?"Cupcake":o[0]===1&&o[1]>=6?"Donut":o[0]===2&&o[1]<2?"Eclair":o[0]===2&&o[1]===2?"Froyo":o[0]===2&&o[1]>2?"Gingerbread":o[0]===3?"Honeycomb":o[0]===4&&o[1]<1?"Ice Cream Sandwich":o[0]===4&&o[1]<4?"Jelly Bean":o[0]===4&&o[1]>=4?"KitKat":o[0]===5?"Lollipop":o[0]===6?"Marshmallow":o[0]===7?"Nougat":o[0]===8?"Oreo":o[0]===9?"Pie":void 0},i.getVersionPrecision=function(c){return c.split(".").length},i.compareVersions=function(c,o,a){a===void 0&&(a=!1);var f=i.getVersionPrecision(c),h=i.getVersionPrecision(o),l=Math.max(f,h),d=0,m=i.map([c,o],function(g){var w=l-i.getVersionPrecision(g),y=g+new Array(w+1).join(".0");return i.map(y.split("."),function(p){return new Array(20-p.length).join("0")+p}).reverse()});for(a&&(d=l-Math.min(f,h)),l-=1;l>=d;){if(m[0][l]>m[1][l])return 1;if(m[0][l]===m[1][l]){if(l===d)return 0;l-=1}else if(m[0][l]<m[1][l])return-1}},i.map=function(c,o){var a,f=[];if(Array.prototype.map)return Array.prototype.map.call(c,o);for(a=0;a<c.length;a+=1)f.push(o(c[a]));return f},i.find=function(c,o){var a,f;if(Array.prototype.find)return Array.prototype.find.call(c,o);for(a=0,f=c.length;a<f;a+=1){var h=c[a];if(o(h,a))return h}},i.assign=function(c){for(var o,a,f=c,h=arguments.length,l=new Array(h>1?h-1:0),d=1;d<h;d++)l[d-1]=arguments[d];if(Object.assign)return Object.assign.apply(Object,[c].concat(l));var m=function(){var g=l[o];typeof g=="object"&&g!==null&&Object.keys(g).forEach(function(w){f[w]=g[w]})};for(o=0,a=l.length;o<a;o+=1)m();return c},i.getBrowserAlias=function(c){return s.BROWSER_ALIASES_MAP[c]},i.getBrowserTypeByAlias=function(c){return s.BROWSER_MAP[c]||""},i}();r.default=n,e.exports=r.default},18:function(e,r,t){r.__esModule=!0,r.ENGINE_MAP=r.OS_MAP=r.PLATFORMS_MAP=r.BROWSER_MAP=r.BROWSER_ALIASES_MAP=void 0,r.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},r.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},r.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},r.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},r.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,r,t){r.__esModule=!0,r.default=void 0;var s,n=(s=t(91))&&s.__esModule?s:{default:s},i=t(18);function c(a,f){for(var h=0;h<f.length;h++){var l=f[h];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(a,l.key,l)}}var o=function(){function a(){}var f,h,l;return a.getParser=function(d,m){if(m===void 0&&(m=!1),typeof d!="string")throw new Error("UserAgent should be a string");return new n.default(d,m)},a.parse=function(d){return new n.default(d).getResult()},f=a,l=[{key:"BROWSER_MAP",get:function(){return i.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return i.ENGINE_MAP}},{key:"OS_MAP",get:function(){return i.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return i.PLATFORMS_MAP}}],(h=null)&&c(f.prototype,h),l&&c(f,l),a}();r.default=o,e.exports=r.default},91:function(e,r,t){r.__esModule=!0,r.default=void 0;var s=a(t(92)),n=a(t(93)),i=a(t(94)),c=a(t(95)),o=a(t(17));function a(h){return h&&h.__esModule?h:{default:h}}var f=function(){function h(d,m){if(m===void 0&&(m=!1),d==null||d==="")throw new Error("UserAgent parameter can't be empty");this._ua=d,this.parsedResult={},m!==!0&&this.parse()}var l=h.prototype;return l.getUA=function(){return this._ua},l.test=function(d){return d.test(this._ua)},l.parseBrowser=function(){var d=this;this.parsedResult.browser={};var m=o.default.find(s.default,function(g){if(typeof g.test=="function")return g.test(d);if(g.test instanceof Array)return g.test.some(function(w){return d.test(w)});throw new Error("Browser's test function is not valid")});return m&&(this.parsedResult.browser=m.describe(this.getUA())),this.parsedResult.browser},l.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},l.getBrowserName=function(d){return d?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},l.getBrowserVersion=function(){return this.getBrowser().version},l.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},l.parseOS=function(){var d=this;this.parsedResult.os={};var m=o.default.find(n.default,function(g){if(typeof g.test=="function")return g.test(d);if(g.test instanceof Array)return g.test.some(function(w){return d.test(w)});throw new Error("Browser's test function is not valid")});return m&&(this.parsedResult.os=m.describe(this.getUA())),this.parsedResult.os},l.getOSName=function(d){var m=this.getOS().name;return d?String(m).toLowerCase()||"":m||""},l.getOSVersion=function(){return this.getOS().version},l.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},l.getPlatformType=function(d){d===void 0&&(d=!1);var m=this.getPlatform().type;return d?String(m).toLowerCase()||"":m||""},l.parsePlatform=function(){var d=this;this.parsedResult.platform={};var m=o.default.find(i.default,function(g){if(typeof g.test=="function")return g.test(d);if(g.test instanceof Array)return g.test.some(function(w){return d.test(w)});throw new Error("Browser's test function is not valid")});return m&&(this.parsedResult.platform=m.describe(this.getUA())),this.parsedResult.platform},l.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},l.getEngineName=function(d){return d?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},l.parseEngine=function(){var d=this;this.parsedResult.engine={};var m=o.default.find(c.default,function(g){if(typeof g.test=="function")return g.test(d);if(g.test instanceof Array)return g.test.some(function(w){return d.test(w)});throw new Error("Browser's test function is not valid")});return m&&(this.parsedResult.engine=m.describe(this.getUA())),this.parsedResult.engine},l.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},l.getResult=function(){return o.default.assign({},this.parsedResult)},l.satisfies=function(d){var m=this,g={},w=0,y={},p=0;if(Object.keys(d).forEach(function(X){var nr=d[X];typeof nr=="string"?(y[X]=nr,p+=1):typeof nr=="object"&&(g[X]=nr,w+=1)}),w>0){var E=Object.keys(g),P=o.default.find(E,function(X){return m.isOS(X)});if(P){var I=this.satisfies(g[P]);if(I!==void 0)return I}var te=o.default.find(E,function(X){return m.isPlatform(X)});if(te){var Me=this.satisfies(g[te]);if(Me!==void 0)return Me}}if(p>0){var tf=Object.keys(y),js=o.default.find(tf,function(X){return m.isBrowser(X,!0)});if(js!==void 0)return this.compareVersion(y[js])}},l.isBrowser=function(d,m){m===void 0&&(m=!1);var g=this.getBrowserName().toLowerCase(),w=d.toLowerCase(),y=o.default.getBrowserTypeByAlias(w);return m&&y&&(w=y.toLowerCase()),w===g},l.compareVersion=function(d){var m=[0],g=d,w=!1,y=this.getBrowserVersion();if(typeof y=="string")return d[0]===">"||d[0]==="<"?(g=d.substr(1),d[1]==="="?(w=!0,g=d.substr(2)):m=[],d[0]===">"?m.push(1):m.push(-1)):d[0]==="="?g=d.substr(1):d[0]==="~"&&(w=!0,g=d.substr(1)),m.indexOf(o.default.compareVersions(y,g,w))>-1},l.isOS=function(d){return this.getOSName(!0)===String(d).toLowerCase()},l.isPlatform=function(d){return this.getPlatformType(!0)===String(d).toLowerCase()},l.isEngine=function(d){return this.getEngineName(!0)===String(d).toLowerCase()},l.is=function(d,m){return m===void 0&&(m=!1),this.isBrowser(d,m)||this.isOS(d)||this.isPlatform(d)},l.some=function(d){var m=this;return d===void 0&&(d=[]),d.some(function(g){return m.is(g)})},h}();r.default=f,e.exports=r.default},92:function(e,r,t){r.__esModule=!0,r.default=void 0;var s,n=(s=t(17))&&s.__esModule?s:{default:s},i=/version\/(\d+(\.?_?\d+)+)/i,c=[{test:[/googlebot/i],describe:function(o){var a={name:"Googlebot"},f=n.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/opera/i],describe:function(o){var a={name:"Opera"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/opr\/|opios/i],describe:function(o){var a={name:"Opera"},f=n.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/SamsungBrowser/i],describe:function(o){var a={name:"Samsung Internet for Android"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/Whale/i],describe:function(o){var a={name:"NAVER Whale Browser"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/MZBrowser/i],describe:function(o){var a={name:"MZ Browser"},f=n.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/focus/i],describe:function(o){var a={name:"Focus"},f=n.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/swing/i],describe:function(o){var a={name:"Swing"},f=n.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/coast/i],describe:function(o){var a={name:"Opera Coast"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(o){var a={name:"Opera Touch"},f=n.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/yabrowser/i],describe:function(o){var a={name:"Yandex Browser"},f=n.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/ucbrowser/i],describe:function(o){var a={name:"UC Browser"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/Maxthon|mxios/i],describe:function(o){var a={name:"Maxthon"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/epiphany/i],describe:function(o){var a={name:"Epiphany"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/puffin/i],describe:function(o){var a={name:"Puffin"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/sleipnir/i],describe:function(o){var a={name:"Sleipnir"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/k-meleon/i],describe:function(o){var a={name:"K-Meleon"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/micromessenger/i],describe:function(o){var a={name:"WeChat"},f=n.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/qqbrowser/i],describe:function(o){var a={name:/qqbrowserlite/i.test(o)?"QQ Browser Lite":"QQ Browser"},f=n.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/msie|trident/i],describe:function(o){var a={name:"Internet Explorer"},f=n.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/\sedg\//i],describe:function(o){var a={name:"Microsoft Edge"},f=n.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/edg([ea]|ios)/i],describe:function(o){var a={name:"Microsoft Edge"},f=n.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/vivaldi/i],describe:function(o){var a={name:"Vivaldi"},f=n.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/seamonkey/i],describe:function(o){var a={name:"SeaMonkey"},f=n.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/sailfish/i],describe:function(o){var a={name:"Sailfish"},f=n.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,o);return f&&(a.version=f),a}},{test:[/silk/i],describe:function(o){var a={name:"Amazon Silk"},f=n.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/phantom/i],describe:function(o){var a={name:"PhantomJS"},f=n.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/slimerjs/i],describe:function(o){var a={name:"SlimerJS"},f=n.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(o){var a={name:"BlackBerry"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/(web|hpw)[o0]s/i],describe:function(o){var a={name:"WebOS Browser"},f=n.default.getFirstMatch(i,o)||n.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/bada/i],describe:function(o){var a={name:"Bada"},f=n.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/tizen/i],describe:function(o){var a={name:"Tizen"},f=n.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/qupzilla/i],describe:function(o){var a={name:"QupZilla"},f=n.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/firefox|iceweasel|fxios/i],describe:function(o){var a={name:"Firefox"},f=n.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/electron/i],describe:function(o){var a={name:"Electron"},f=n.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/MiuiBrowser/i],describe:function(o){var a={name:"Miui"},f=n.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/chromium/i],describe:function(o){var a={name:"Chromium"},f=n.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,o)||n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/chrome|crios|crmo/i],describe:function(o){var a={name:"Chrome"},f=n.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/GSA/i],describe:function(o){var a={name:"Google Search"},f=n.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:function(o){var a=!o.test(/like android/i),f=o.test(/android/i);return a&&f},describe:function(o){var a={name:"Android Browser"},f=n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/playstation 4/i],describe:function(o){var a={name:"PlayStation 4"},f=n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/safari|applewebkit/i],describe:function(o){var a={name:"Safari"},f=n.default.getFirstMatch(i,o);return f&&(a.version=f),a}},{test:[/.*/i],describe:function(o){var a=o.search("\\(")!==-1?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:n.default.getFirstMatch(a,o),version:n.default.getSecondMatch(a,o)}}}];r.default=c,e.exports=r.default},93:function(e,r,t){r.__esModule=!0,r.default=void 0;var s,n=(s=t(17))&&s.__esModule?s:{default:s},i=t(18),c=[{test:[/Roku\/DVP/],describe:function(o){var a=n.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,o);return{name:i.OS_MAP.Roku,version:a}}},{test:[/windows phone/i],describe:function(o){var a=n.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,o);return{name:i.OS_MAP.WindowsPhone,version:a}}},{test:[/windows /i],describe:function(o){var a=n.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,o),f=n.default.getWindowsVersionName(a);return{name:i.OS_MAP.Windows,version:a,versionName:f}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(o){var a={name:i.OS_MAP.iOS},f=n.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,o);return f&&(a.version=f),a}},{test:[/macintosh/i],describe:function(o){var a=n.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,o).replace(/[_\s]/g,"."),f=n.default.getMacOSVersionName(a),h={name:i.OS_MAP.MacOS,version:a};return f&&(h.versionName=f),h}},{test:[/(ipod|iphone|ipad)/i],describe:function(o){var a=n.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,o).replace(/[_\s]/g,".");return{name:i.OS_MAP.iOS,version:a}}},{test:function(o){var a=!o.test(/like android/i),f=o.test(/android/i);return a&&f},describe:function(o){var a=n.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,o),f=n.default.getAndroidVersionName(a),h={name:i.OS_MAP.Android,version:a};return f&&(h.versionName=f),h}},{test:[/(web|hpw)[o0]s/i],describe:function(o){var a=n.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,o),f={name:i.OS_MAP.WebOS};return a&&a.length&&(f.version=a),f}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(o){var a=n.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,o)||n.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,o)||n.default.getFirstMatch(/\bbb(\d+)/i,o);return{name:i.OS_MAP.BlackBerry,version:a}}},{test:[/bada/i],describe:function(o){var a=n.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,o);return{name:i.OS_MAP.Bada,version:a}}},{test:[/tizen/i],describe:function(o){var a=n.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,o);return{name:i.OS_MAP.Tizen,version:a}}},{test:[/linux/i],describe:function(){return{name:i.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:i.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(o){var a=n.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,o);return{name:i.OS_MAP.PlayStation4,version:a}}}];r.default=c,e.exports=r.default},94:function(e,r,t){r.__esModule=!0,r.default=void 0;var s,n=(s=t(17))&&s.__esModule?s:{default:s},i=t(18),c=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(o){var a=n.default.getFirstMatch(/(can-l01)/i,o)&&"Nova",f={type:i.PLATFORMS_MAP.mobile,vendor:"Huawei"};return a&&(f.model=a),f}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(o){var a=o.test(/ipod|iphone/i),f=o.test(/like (ipod|iphone)/i);return a&&!f},describe:function(o){var a=n.default.getFirstMatch(/(ipod|iphone)/i,o);return{type:i.PLATFORMS_MAP.mobile,vendor:"Apple",model:a}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(o){return o.getBrowserName(!0)==="blackberry"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(o){return o.getBrowserName(!0)==="bada"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(o){return o.getBrowserName()==="windows phone"},describe:function(){return{type:i.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(o){var a=Number(String(o.getOSVersion()).split(".")[0]);return o.getOSName(!0)==="android"&&a>=3},describe:function(){return{type:i.PLATFORMS_MAP.tablet}}},{test:function(o){return o.getOSName(!0)==="android"},describe:function(){return{type:i.PLATFORMS_MAP.mobile}}},{test:function(o){return o.getOSName(!0)==="macos"},describe:function(){return{type:i.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(o){return o.getOSName(!0)==="windows"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(o){return o.getOSName(!0)==="linux"},describe:function(){return{type:i.PLATFORMS_MAP.desktop}}},{test:function(o){return o.getOSName(!0)==="playstation 4"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}},{test:function(o){return o.getOSName(!0)==="roku"},describe:function(){return{type:i.PLATFORMS_MAP.tv}}}];r.default=c,e.exports=r.default},95:function(e,r,t){r.__esModule=!0,r.default=void 0;var s,n=(s=t(17))&&s.__esModule?s:{default:s},i=t(18),c=[{test:function(o){return o.getBrowserName(!0)==="microsoft edge"},describe:function(o){if(/\sedg\//i.test(o))return{name:i.ENGINE_MAP.Blink};var a=n.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,o);return{name:i.ENGINE_MAP.EdgeHTML,version:a}}},{test:[/trident/i],describe:function(o){var a={name:i.ENGINE_MAP.Trident},f=n.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:function(o){return o.test(/presto/i)},describe:function(o){var a={name:i.ENGINE_MAP.Presto},f=n.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:function(o){var a=o.test(/gecko/i),f=o.test(/like gecko/i);return a&&!f},describe:function(o){var a={name:i.ENGINE_MAP.Gecko},f=n.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:i.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(o){var a={name:i.ENGINE_MAP.WebKit},f=n.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,o);return f&&(a.version=f),a}}];r.default=c,e.exports=r.default}})})});var ir=(e)=>{let r=e.httpHandler;return{setHttpHandler(t){r=t},httpHandler(){return r},updateHttpClientConfig(t,s){r.updateHttpClientConfig(t,s)},httpHandlerConfigs(){return r.httpHandlerConfigs()}}},or=(e)=>{return{httpHandler:e.httpHandler()}};var tn;(function(e){e.HEADER="header",e.QUERY="query"})(tn||(tn={}));var Ut;(function(e){e.HEADER="header",e.QUERY="query"})(Ut||(Ut={}));var Te;(function(e){e.HTTP="http",e.HTTPS="https"})(Te||(Te={}));var Pe;(function(e){e.MD5="md5",e.CRC32="crc32",e.CRC32C="crc32c",e.SHA1="sha1",e.SHA256="sha256"})(Pe||(Pe={}));var bt;(function(e){e[e.HEADER=0]="HEADER",e[e.TRAILER=1]="TRAILER"})(bt||(bt={}));var se="__smithy_context";var sn;(function(e){e.PROFILE="profile",e.SSO_SESSION="sso-session",e.SERVICES="services"})(sn||(sn={}));var nn;(function(e){e.HTTP_0_9="http/0.9",e.HTTP_1_0="http/1.0",e.TDS_8_0="tds/8.0"})(nn||(nn={}));function cf(e){return Object.keys(e).reduce((r,t)=>{const s=e[t];return{...r,[t]:Array.isArray(s)?[...s]:s}},{})}class u{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 r=new u({...e,headers:{...e.headers}});if(r.query)r.query=cf(r.query);return r}static isInstance(e){if(!e)return!1;const r=e;return"method"in r&&"protocol"in r&&"hostname"in r&&"path"in r&&typeof r.query==="object"&&typeof r.headers==="object"}clone(){return u.clone(this)}}class Q{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 r=e;return typeof r.statusCode==="number"&&typeof r.headers==="object"}}function ar(e){return e}var df=(e)=>(r)=>async(t)=>{if(!u.isInstance(t.request))return r(t);const{request:s}=t,{handlerProtocol:n=""}=e.requestHandler.metadata||{};if(n.indexOf("h2")>=0&&!s.headers[":authority"])delete s.headers.host,s.headers[":authority"]=s.hostname+(s.port?":"+s.port:"");else if(!s.headers.host){let i=s.hostname;if(s.port!=null)i+=`:${s.port}`;s.headers.host=i}return r(t)},lf={name:"hostHeaderMiddleware",step:"build",priority:"low",tags:["HOST"],override:!0},fr=(e)=>({applyToStack:(r)=>{r.add(df(e),lf)}});var mf=()=>(e,r)=>async(t)=>{try{const s=await e(t),{clientName:n,commandName:i,logger:c,dynamoDbDocumentClientOptions:o={}}=r,{overrideInputFilterSensitiveLog:a,overrideOutputFilterSensitiveLog:f}=o,h=a??r.inputFilterSensitiveLog,l=f??r.outputFilterSensitiveLog,{$metadata:d,...m}=s.output;return c?.info?.({clientName:n,commandName:i,input:h(t.input),output:l(m),metadata:d}),s}catch(s){const{clientName:n,commandName:i,logger:c,dynamoDbDocumentClientOptions:o={}}=r,{overrideInputFilterSensitiveLog:a}=o,f=a??r.inputFilterSensitiveLog;throw c?.error?.({clientName:n,commandName:i,input:f(t.input),error:s,metadata:s.$metadata}),s}},hf={name:"loggerMiddleware",tags:["LOGGER"],step:"initialize",override:!0},cr=(e)=>({applyToStack:(r)=>{r.add(mf(),hf)}});var on="X-Amzn-Trace-Id",gf="AWS_LAMBDA_FUNCTION_NAME",yf="_X_AMZN_TRACE_ID",wf=(e)=>(r)=>async(t)=>{const{request:s}=t;if(!u.isInstance(s)||e.runtime!=="node"||s.headers.hasOwnProperty(on))return r(t);const n=process.env[gf],i=process.env[yf],c=(o)=>typeof o==="string"&&o.length>0;if(c(n)&&c(i))s.headers[on]=i;return r({...t,request:s})},pf={step:"build",tags:["RECURSION_DETECTION"],name:"recursionDetectionMiddleware",override:!0,priority:"low"},dr=(e)=>({applyToStack:(r)=>{r.add(wf(e),pf)}});function lr(e){return{...e,customUserAgent:typeof e.customUserAgent==="string"?[[e.customUserAgent]]:e.customUserAgent}}var Sf=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}$"),Le=(e)=>Sf.test(e)||e.startsWith("[")&&e.endsWith("]");var Ef=new RegExp("^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$"),_e=(e,r=!1)=>{if(!r)return Ef.test(e);const t=e.split(".");for(let s of t)if(!_e(s))return!1;return!0};var J={};var Z="endpoints";function L(e){if(typeof e!=="object"||e==null)return e;if("ref"in e)return`\$${L(e.ref)}`;if("fn"in e)return`${e.fn}(${(e.argv||[]).map(L).join(", ")})`;return JSON.stringify(e,null,2)}class M extends Error{constructor(e){super(e);this.name="EndpointError"}}var an=(e,r)=>e===r;var fn=(e)=>{const r=e.split("."),t=[];for(let s of r){const n=s.indexOf("[");if(n!==-1){if(s.indexOf("]")!==s.length-1)throw new M(`Path: '${e}' does not end with ']'`);const i=s.slice(n+1,-1);if(Number.isNaN(parseInt(i)))throw new M(`Invalid array index: '${i}' in path: '${e}'`);if(n!==0)t.push(s.slice(0,n));t.push(i)}else t.push(s)}return t};var mr=(e,r)=>fn(r).reduce((t,s)=>{if(typeof t!=="object")throw new M(`Index '${s}' in '${r}' not found in '${JSON.stringify(e)}'`);else if(Array.isArray(t))return t[parseInt(s)];return t[s]},e);var cn=(e)=>e!=null;var dn=(e)=>!e;var Lt={[Te.HTTP]:80,[Te.HTTPS]:443},ln=(e)=>{const r=(()=>{try{if(e instanceof URL)return e;if(typeof e==="object"&&"hostname"in e){const{hostname:d,port:m,protocol:g="",path:w="",query:y={}}=e,p=new URL(`${g}//${d}${m?`:${m}`:""}${w}`);return p.search=Object.entries(y).map(([E,P])=>`${E}=${P}`).join("&"),p}return new URL(e)}catch(d){return null}})();if(!r)return console.error(`Unable to parse ${JSON.stringify(e)} as a whatwg URL.`),null;const t=r.href,{host:s,hostname:n,pathname:i,protocol:c,search:o}=r;if(o)return null;const a=c.slice(0,-1);if(!Object.values(Te).includes(a))return null;const f=Le(n),h=t.includes(`${s}:${Lt[a]}`)||typeof e==="string"&&e.includes(`${s}:${Lt[a]}`),l=`${s}${h?`:${Lt[a]}`:""}`;return{scheme:a,authority:l,path:i,normalizedPath:i.endsWith("/")?i:`${i}/`,isIp:f}};var mn=(e,r)=>e===r;var hn=(e,r,t,s)=>{if(r>=t||e.length<t)return null;if(!s)return e.substring(r,t);return e.substring(e.length-t,e.length-r)};var gn=(e)=>encodeURIComponent(e).replace(/[!*'()]/g,(r)=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`);var yn={booleanEquals:an,getAttr:mr,isSet:cn,isValidHostLabel:_e,not:dn,parseURL:ln,stringEquals:mn,substring:hn,uriEncode:gn};var hr=(e,r)=>{const t=[],s={...r.endpointParams,...r.referenceRecord};let n=0;while(n<e.length){const i=e.indexOf("{",n);if(i===-1){t.push(e.slice(n));break}t.push(e.slice(n,i));const c=e.indexOf("}",i);if(c===-1){t.push(e.slice(i));break}if(e[i+1]==="{"&&e[c+1]==="}")t.push(e.slice(i+1,c)),n=c+2;const o=e.substring(i+1,c);if(o.includes("#")){const[a,f]=o.split("#");t.push(mr(s[a],f))}else t.push(s[o]);n=c+1}return t.join("")};var wn=({ref:e},r)=>{return{...r.endpointParams,...r.referenceRecord}[e]};var ne=(e,r,t)=>{if(typeof e==="string")return hr(e,t);else if(e.fn)return gr(e,t);else if(e.ref)return wn(e,t);throw new M(`'${r}': ${String(e)} is not a string, function or reference.`)};var gr=({fn:e,argv:r},t)=>{const s=r.map((i)=>["boolean","number"].includes(typeof i)?i:ne(i,"arg",t)),n=e.split(".");if(n[0]in J&&n[1]!=null)return J[n[0]][n[1]](...s);return yn[e](...s)};var pn=({assign:e,...r},t)=>{if(e&&e in t.referenceRecord)throw new M(`'${e}' is already defined in Reference Record.`);const s=gr(r,t);return t.logger?.debug?.(`${Z} evaluateCondition: ${L(r)} = ${L(s)}`),{result:s===""?!0:!!s,...e!=null&&{toAssign:{name:e,value:s}}}};var Ie=(e=[],r)=>{const t={};for(let s of e){const{result:n,toAssign:i}=pn(s,{...r,referenceRecord:{...r.referenceRecord,...t}});if(!n)return{result:n};if(i)t[i.name]=i.value,r.logger?.debug?.(`${Z} assign: ${i.name} := ${L(i.value)}`)}return{result:!0,referenceRecord:t}};var Sn=(e,r)=>Object.entries(e).reduce((t,[s,n])=>({...t,[s]:n.map((i)=>{const c=ne(i,"Header value entry",r);if(typeof c!=="string")throw new M(`Header '${s}' value '${c}' is not a string`);return c})}),{});var _t=(e,r)=>{if(Array.isArray(e))return e.map((t)=>_t(t,r));switch(typeof e){case"string":return hr(e,r);case"object":if(e===null)throw new M(`Unexpected endpoint property: ${e}`);return yr(e,r);case"boolean":return e;default:throw new M(`Unexpected endpoint property type: ${typeof e}`)}};var yr=(e,r)=>Object.entries(e).reduce((t,[s,n])=>({...t,[s]:_t(n,r)}),{});var En=(e,r)=>{const t=ne(e,"Endpoint URL",r);if(typeof t==="string")try{return new URL(t)}catch(s){throw console.error(`Failed to construct URL with ${t}`,s),s}throw new M(`Endpoint URL must be a string, got ${typeof t}`)};var An=(e,r)=>{const{conditions:t,endpoint:s}=e,{result:n,referenceRecord:i}=Ie(t,r);if(!n)return;const c={...r,referenceRecord:{...r.referenceRecord,...i}},{url:o,properties:a,headers:f}=s;return r.logger?.debug?.(`${Z} Resolving endpoint from template: ${L(s)}`),{...f!=null&&{headers:Sn(f,c)},...a!=null&&{properties:yr(a,c)},url:En(o,c)}};var Rn=(e,r)=>{const{conditions:t,error:s}=e,{result:n,referenceRecord:i}=Ie(t,r);if(!n)return;throw new M(ne(s,"Error",{...r,referenceRecord:{...r.referenceRecord,...i}}))};var un=(e,r)=>{const{conditions:t,rules:s}=e,{result:n,referenceRecord:i}=Ie(t,r);if(!n)return;return wr(s,{...r,referenceRecord:{...r.referenceRecord,...i}})};var wr=(e,r)=>{for(let t of e)if(t.type==="endpoint"){const s=An(t,r);if(s)return s}else if(t.type==="error")Rn(t,r);else if(t.type==="tree"){const s=un(t,r);if(s)return s}else throw new M(`Unknown endpoint rule: ${t}`);throw new M("Rules evaluation failed")};var Be=(e,r)=>{const{endpointParams:t,logger:s}=r,{parameters:n,rules:i}=e;r.logger?.debug?.(`${Z} Initial EndpointParams: ${L(t)}`);const c=Object.entries(n).filter(([,f])=>f.default!=null).map(([f,h])=>[f,h.default]);if(c.length>0)for(let[f,h]of c)t[f]=t[f]??h;const o=Object.entries(n).filter(([,f])=>f.required).map(([f])=>f);for(let f of o)if(t[f]==null)throw new M(`Missing required parameter: '${f}'`);const a=wr(i,{endpointParams:t,logger:s,referenceRecord:{}});if(r.endpointParams?.Endpoint)try{const f=new URL(r.endpointParams.Endpoint),{protocol:h,port:l}=f;a.url.protocol=h,a.url.port=l}catch(f){}return r.logger?.debug?.(`${Z} Resolved endpoint: ${L(a)}`),a};var Bt=(e,r=!1)=>{if(r){for(let t of e.split("."))if(!Bt(t))return!1;return!0}if(!_e(e))return!1;if(e.length<3||e.length>63)return!1;if(e!==e.toLowerCase())return!1;if(Le(e))return!1;return!0};var Mn=(e)=>{const r=e.split(":");if(r.length<6)return null;const[t,s,n,i,c,...o]=r;if(t!=="arn"||s===""||n===""||o.join(":")==="")return null;const a=o.map((f)=>f.split("/")).flat();return{partition:s,service:n,region:i,accountId:c,resourceId:a}};var Tn={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)\\-\\w+\\-\\d+$",regions:{"af-south-1":{description:"Africa (Cape Town)"},"ap-east-1":{description:"Asia Pacific (Hong Kong)"},"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)"},"aws-global":{description:"AWS Standard 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)"},"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 China global region"},"cn-north-1":{description:"China (Beijing)"},"cn-northwest-1":{description:"China (Ningxia)"}}},{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 GovCloud (US) global region"},"us-gov-east-1":{description:"AWS GovCloud (US-East)"},"us-gov-west-1":{description:"AWS GovCloud (US-West)"}}},{id:"aws-iso",outputs:{dnsSuffix:"c2s.ic.gov",dualStackDnsSuffix:"c2s.ic.gov",implicitGlobalRegion:"us-iso-east-1",name:"aws-iso",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-iso\\-\\w+\\-\\d+$",regions:{"aws-iso-global":{description:"AWS ISO (US) 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:"sc2s.sgov.gov",implicitGlobalRegion:"us-isob-east-1",name:"aws-iso-b",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isob\\-\\w+\\-\\d+$",regions:{"aws-iso-b-global":{description:"AWS ISOB (US) global region"},"us-isob-east-1":{description:"US ISOB East (Ohio)"}}},{id:"aws-iso-e",outputs:{dnsSuffix:"cloud.adc-e.uk",dualStackDnsSuffix:"cloud.adc-e.uk",implicitGlobalRegion:"eu-isoe-west-1",name:"aws-iso-e",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^eu\\-isoe\\-\\w+\\-\\d+$",regions:{"eu-isoe-west-1":{description:"EU ISOE West"}}},{id:"aws-iso-f",outputs:{dnsSuffix:"csp.hci.ic.gov",dualStackDnsSuffix:"csp.hci.ic.gov",implicitGlobalRegion:"us-isof-south-1",name:"aws-iso-f",supportsDualStack:!1,supportsFIPS:!0},regionRegex:"^us\\-isof\\-\\w+\\-\\d+$",regions:{}}],version:"1.1"};var Rf=Tn,uf="",Pn=(e)=>{const{partitions:r}=Rf;for(let s of r){const{regions:n,outputs:i}=s;for(let[c,o]of Object.entries(n))if(c===e)return{...i,...o}}for(let s of r){const{regionRegex:n,outputs:i}=s;if(new RegExp(n).test(e))return{...i}}const t=r.find((s)=>s.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}};var In=()=>uf;var Ge={isVirtualHostableS3Bucket:Bt,parseArn:Mn,partition:Pn};J.aws=Ge;var Gt="user-agent",pr="x-amz-user-agent",zt=" ",Sr="/",Nn=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g,On=/[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g,Ht="-";var Mf=(e)=>(r,t)=>async(s)=>{const{request:n}=s;if(!u.isInstance(n))return r(s);const{headers:i}=n,c=t?.userAgent?.map(Wt)||[],o=(await e.defaultUserAgentProvider()).map(Wt),a=e?.customUserAgent?.map(Wt)||[],f=In(),h=(f?[f]:[]).concat([...o,...c,...a]).join(zt),l=[...o.filter((d)=>d.startsWith("aws-sdk-")),...a].join(zt);if(e.runtime!=="browser"){if(l)i[pr]=i[pr]?`${i[Gt]} ${l}`:l;i[Gt]=h}else i[pr]=h;return r({...s,request:n})},Wt=(e)=>{const r=e[0].split(Sr).map((c)=>c.replace(Nn,Ht)).join(Sr),t=e[1]?.replace(On,Ht),s=r.indexOf(Sr),n=r.substring(0,s);let i=r.substring(s+1);if(n==="api")i=i.toLowerCase();return[n,i,t].filter((c)=>c&&c.length>0).reduce((c,o,a)=>{switch(a){case 0:return o;case 1:return`${c}/${o}`;default:return`${c}#${o}`}},"")},Tf={name:"getUserAgentMiddleware",step:"build",priority:"low",tags:["SET_USER_AGENT","USER_AGENT"],override:!0},Er=(e)=>({applyToStack:(r)=>{r.add(Mf(e),Tf)}});var Ar;(function(e){e.ENV="env",e.CONFIG="shared config entry"})(Ar||(Ar={}));var Rr=!1;var ur=!1;var W=(e)=>e[se]||(e[se]={});var F=(e)=>{if(typeof e==="function")return e;const r=Promise.resolve(e);return()=>r};var Mr=(e)=>typeof e==="string"&&(e.startsWith("fips-")||e.endsWith("-fips"));var qt=(e)=>Mr(e)?["fips-aws-global","aws-fips"].includes(e)?"us-east-1":e.replace(/fips-(dkr-|prod-)?|-fips/,""):e;var Tr=(e)=>{const{region:r,useFipsEndpoint:t}=e;if(!r)throw new Error("Region is missing");return{...e,region:async()=>{if(typeof r==="string")return qt(r);const s=await r();return qt(s)},useFipsEndpoint:async()=>{const s=typeof r==="string"?r:await r();if(Mr(s))return!0;return typeof t!=="function"?Promise.resolve(!!t):t()}}};function If(e){const r=new Map;for(let t of e)r.set(t.schemeId,t);return r}var vt=(e,r)=>(t,s)=>async(n)=>{const i=e.httpAuthSchemeProvider(await r.httpAuthSchemeParametersProvider(e,s,n.input)),c=If(e.httpAuthSchemes),o=W(s),a=[];for(let f of i){const h=c.get(f.schemeId);if(!h){a.push(`HttpAuthScheme \`${f.schemeId}\` was not enabled for this service.`);continue}const l=h.identityProvider(await r.identityProviderConfigProvider(e));if(!l){a.push(`HttpAuthScheme \`${f.schemeId}\` did not have an IdentityProvider configured.`);continue}const{identityProperties:d={},signingProperties:m={}}=f.propertiesExtractor?.(e,s)||{};f.identityProperties=Object.assign(f.identityProperties||{},d),f.signingProperties=Object.assign(f.signingProperties||{},m),o.selectedHttpAuthScheme={httpAuthOption:f,identity:await l(f.identityProperties),signer:h.signer};break}if(!o.selectedHttpAuthScheme)throw new Error(a.join("\n"));return t(n)};var kn=async(e)=>{const r=e?.Bucket||"";if(typeof e.Bucket==="string")e.Bucket=r.replace(/#/g,encodeURIComponent("#")).replace(/\?/g,encodeURIComponent("?"));if(xf(r)){if(e.ForcePathStyle===!0)throw new Error("Path-style addressing cannot be used with ARN buckets")}else if(!Ff(r)||r.indexOf(".")!==-1&&!String(e.Endpoint).startsWith("http:")||r.toLowerCase()!==r||r.length<3)e.ForcePathStyle=!0;if(e.DisableMultiRegionAccessPoints)e.disableMultiRegionAccessPoints=!0,e.DisableMRAP=!0;return e},Nf=/^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/,Of=/(\d+\.){3}\d+/,kf=/\.\./;var Ff=(e)=>Nf.test(e)&&!Of.test(e)&&!kf.test(e),xf=(e)=>{const[r,t,s,,,n]=e.split(":"),i=r==="arn"&&e.split(":").length>=6,c=Boolean(i&&t&&s&&n);if(i&&!c)throw new Error(`Invalid ARN: ${e} was an invalid ARN.`);return c};var Fn=(e,r,t)=>{const s=async()=>{const n=t[e]??t[r];if(typeof n==="function")return n();return n};if(e==="credentialScope"||r==="CredentialScope")return async()=>{const n=typeof t.credentials==="function"?await t.credentials():t.credentials;return n?.credentialScope??n?.CredentialScope};if(e==="accountId"||r==="AccountId")return async()=>{const n=typeof t.credentials==="function"?await t.credentials():t.credentials;return n?.accountId??n?.AccountId};if(e==="endpoint"||r==="endpoint")return async()=>{const n=await s();if(n&&typeof n==="object"){if("url"in n)return n.url.href;if("hostname"in n){const{protocol:i,hostname:c,port:o,path:a}=n;return`${i}//${c}${o?":"+o:""}${a}`}}return n};return s};var xn=async(e)=>{return};function Cn(e){const r={};if(e=e.replace(/^\?/,""),e)for(let t of e.split("&")){let[s,n=null]=t.split("=");if(s=decodeURIComponent(s),n)n=decodeURIComponent(n);if(!(s in r))r[s]=n;else if(Array.isArray(r[s]))r[s].push(n);else r[s]=[r[s],n]}return r}var ie=(e)=>{if(typeof e==="string")return ie(new URL(e));const{hostname:r,pathname:t,port:s,protocol:n,search:i}=e;let c;if(i)c=Cn(i);return{hostname:r,port:s?parseInt(s):void 0,protocol:n,path:t,query:c}};var Pr=(e)=>{if(typeof e==="object"){if("url"in e)return ie(e.url);return e}return ie(e)};var $n=async(e,r,t,s)=>{if(!t.endpoint){const c=await xn(t.serviceId||"");if(c)t.endpoint=()=>Promise.resolve(Pr(c))}const n=await Cf(e,r,t);if(typeof t.endpointProvider!=="function")throw new Error("config.endpointProvider is not set.");return t.endpointProvider(n,s)},Cf=async(e,r,t)=>{const s={},n=r?.getEndpointParameterInstructions?.()||{};for(let[i,c]of Object.entries(n))switch(c.type){case"staticContextParams":s[i]=c.value;break;case"contextParams":s[i]=e[c.name];break;case"clientContextParams":case"builtInParams":s[i]=await Fn(c.name,i,t)();break;default:throw new Error("Unrecognized endpoint parameter instruction: "+JSON.stringify(c))}if(Object.keys(n).length===0)Object.assign(s,t);if(String(t.serviceId).toLowerCase()==="s3")await kn(s);return s};var Dn=({config:e,instructions:r})=>{return(t,s)=>async(n)=>{const i=await $n(n.input,{getEndpointParameterInstructions(){return r}},{...e},s);s.endpointV2=i,s.authSchemes=i.properties?.authSchemes;const c=s.authSchemes?.[0];if(c){s.signing_region=c.signingRegion,s.signing_service=c.signingName;const a=W(s)?.selectedHttpAuthScheme?.httpAuthOption;if(a)a.signingProperties=Object.assign(a.signingProperties||{},{signing_region:c.signingRegion,signingRegion:c.signingRegion,signing_service:c.signingName,signingName:c.signingName,signingRegionSet:c.signingRegionSet},c.properties)}return t({...n})}};var Un=(e,r)=>(t)=>async(s)=>{const{response:n}=await t(s);try{const i=await r(n,e);return{response:n,output:i}}catch(i){if(Object.defineProperty(i,"$response",{value:n}),!("$metadata"in i)){if(i.message+="\n Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.",typeof i.$responseBodyText!=="undefined"){if(i.$response)i.$response.body=i.$responseBodyText}}throw i}};var bn=(e,r)=>(t,s)=>async(n)=>{const i=s.endpointV2?.url&&e.urlParser?async()=>e.urlParser(s.endpointV2.url):e.endpoint;if(!i)throw new Error("No valid endpoint provider available.");const c=await r(n.input,{...e,endpoint:i});return t({...n,request:c})};function q(e,r,t){return{applyToStack:(s)=>{s.add(Un(e,t),$f),s.add(bn(e,r),ze)}}}var $f={name:"deserializerMiddleware",step:"deserialize",tags:["DESERIALIZER"],override:!0},ze={name:"serializerMiddleware",step:"serialize",tags:["SERIALIZER"],override:!0};var Vt={step:"serialize",tags:["ENDPOINT_PARAMETERS","ENDPOINT_V2","ENDPOINT"],name:"endpointV2Middleware",override:!0,relation:"before",toMiddleware:ze.name},v=(e,r)=>({applyToStack:(t)=>{t.addRelativeTo(Dn({config:e,instructions:r}),Vt)}});var Ir=(e)=>{const r=e.tls??!0,{endpoint:t}=e,s=t!=null?async()=>Pr(await F(t)()):void 0;return{...e,endpoint:s,tls:r,isCustomEndpoint:!!t,useDualstackEndpoint:F(e.useDualstackEndpoint??!1),useFipsEndpoint:F(e.useFipsEndpoint??!1)}};var Df={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:Vt.name},Nr=(e,{httpAuthSchemeParametersProvider:r,identityProviderConfigProvider:t})=>({applyToStack:(s)=>{s.addRelativeTo(vt(e,{httpAuthSchemeParametersProvider:r,identityProviderConfigProvider:t}),Df)}});var tp={step:"serialize",tags:["HTTP_AUTH_SCHEME"],name:"httpAuthSchemeMiddleware",override:!0,relation:"before",toMiddleware:ze.name};var Uf=(e)=>(r)=>{throw r},bf=(e,r)=>{},Ln=(e)=>(r,t)=>async(s)=>{if(!u.isInstance(s.request))return r(s);const i=W(t).selectedHttpAuthScheme;if(!i)throw new Error("No HttpAuthScheme was selected: unable to sign request");const{httpAuthOption:{signingProperties:c={}},identity:o,signer:a}=i,f=await r({...s,request:await a.sign(s.request,o,c)}).catch((a.errorHandler||Uf)(c));return(a.successHandler||bf)(f.response,c),f};var _;(function(e){e.STANDARD="standard",e.ADAPTIVE="adaptive"})(_||(_={}));var V=3,He=_.STANDARD;var _n=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException","TransactionInProgressException"],Bn=["TimeoutError","RequestTimeout","RequestTimeoutException"],Gn=[500,502,503,504],zn=["ECONNRESET","ECONNREFUSED","EPIPE","ETIMEDOUT"];var Lf=(e)=>e.$metadata?.clockSkewCorrected,Ne=(e)=>e.$metadata?.httpStatusCode===429||_n.includes(e.name)||e.$retryable?.throttling==!0,Or=(e)=>Lf(e)||Bn.includes(e.name)||zn.includes(e?.code||"")||Gn.includes(e.$metadata?.httpStatusCode||0),Hn=(e)=>{if(e.$metadata?.httpStatusCode!==void 0){const r=e.$metadata.httpStatusCode;if(500<=r&&r<=599&&!Or(e))return!0;return!1}return!1};class kr{constructor(e){this.currentCapacity=0,this.enabled=!1,this.lastMaxRate=0,this.measuredTxRate=0,this.requestCount=0,this.lastTimestamp=0,this.timeWindow=0,this.beta=e?.beta??0.7,this.minCapacity=e?.minCapacity??1,this.minFillRate=e?.minFillRate??0.5,this.scaleConstant=e?.scaleConstant??0.4,this.smooth=e?.smooth??0.8;const r=this.getCurrentTimeInSeconds();this.lastThrottleTime=r,this.lastTxRateBucket=Math.floor(this.getCurrentTimeInSeconds()),this.fillRate=this.minFillRate,this.maxCapacity=this.minCapacity}getCurrentTimeInSeconds(){return Date.now()/1000}async getSendToken(){return this.acquireTokenBucket(1)}async acquireTokenBucket(e){if(!this.enabled)return;if(this.refillTokenBucket(),e>this.currentCapacity){const r=(e-this.currentCapacity)/this.fillRate*1000;await new Promise((t)=>setTimeout(t,r))}this.currentCapacity=this.currentCapacity-e}refillTokenBucket(){const e=this.getCurrentTimeInSeconds();if(!this.lastTimestamp){this.lastTimestamp=e;return}const r=(e-this.lastTimestamp)*this.fillRate;this.currentCapacity=Math.min(this.maxCapacity,this.currentCapacity+r),this.lastTimestamp=e}updateClientSendingRate(e){let r;if(this.updateMeasuredRate(),Ne(e)){const s=!this.enabled?this.measuredTxRate:Math.min(this.measuredTxRate,this.fillRate);this.lastMaxRate=s,this.calculateTimeWindow(),this.lastThrottleTime=this.getCurrentTimeInSeconds(),r=this.cubicThrottle(s),this.enableTokenBucket()}else this.calculateTimeWindow(),r=this.cubicSuccess(this.getCurrentTimeInSeconds());const t=Math.min(r,2*this.measuredTxRate);this.updateTokenBucketRate(t)}calculateTimeWindow(){this.timeWindow=this.getPrecise(Math.pow(this.lastMaxRate*(1-this.beta)/this.scaleConstant,0.3333333333333333))}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.currentCapacity=Math.min(this.currentCapacity,this.maxCapacity)}updateMeasuredRate(){const e=this.getCurrentTimeInSeconds(),r=Math.floor(e*2)/2;if(this.requestCount++,r>this.lastTxRateBucket){const t=this.requestCount/(r-this.lastTxRateBucket);this.measuredTxRate=this.getPrecise(t*this.smooth+this.measuredTxRate*(1-this.smooth)),this.requestCount=0,this.lastTxRateBucket=r}}getPrecise(e){return parseFloat(e.toFixed(8))}}var he=100,We=20000,Yt=500,Fr=500,Kt=5,Xt=10,Qt=1,xr="amz-sdk-invocation-id",Cr="amz-sdk-request";var Wn=()=>{let e=he;return{computeNextBackoffDelay:(s)=>{return Math.floor(Math.min(We,Math.random()*2**s*e))},setDelayBase:(s)=>{e=s}}};var Jt=({retryDelay:e,retryCount:r,retryCost:t})=>{return{getRetryCount:()=>r,getRetryDelay:()=>Math.min(We,e),getRetryCost:()=>t}};class Oe{constructor(e){this.maxAttempts=e,this.mode=_.STANDARD,this.capacity=Fr,this.retryBackoffStrategy=Wn(),this.maxAttemptsProvider=typeof e==="function"?e:async()=>e}async acquireInitialRetryToken(e){return Jt({retryDelay:he,retryCount:0})}async refreshRetryTokenForRetry(e,r){const t=await this.getMaxAttempts();if(this.shouldRetry(e,r,t)){const s=r.errorType;this.retryBackoffStrategy.setDelayBase(s==="THROTTLING"?Yt:he);const n=this.retryBackoffStrategy.computeNextBackoffDelay(e.getRetryCount()),i=r.retryAfterHint?Math.max(r.retryAfterHint.getTime()-Date.now()||0,n):n,c=this.getCapacityCost(s);return this.capacity-=c,Jt({retryDelay:i,retryCount:e.getRetryCount()+1,retryCost:c})}throw new Error("No retry token available")}recordSuccess(e){this.capacity=Math.max(Fr,this.capacity+(e.getRetryCost()??Qt))}getCapacity(){return this.capacity}async getMaxAttempts(){try{return await this.maxAttemptsProvider()}catch(e){return console.warn(`Max attempts provider could not resolve. Using default of ${V}`),V}}shouldRetry(e,r,t){return e.getRetryCount()+1<t&&this.capacity>=this.getCapacityCost(r.errorType)&&this.isRetryableError(r.errorType)}getCapacityCost(e){return e==="TRANSIENT"?Xt:Kt}isRetryableError(e){return e==="THROTTLING"||e==="TRANSIENT"}}class Zt{constructor(e,r){this.maxAttemptsProvider=e,this.mode=_.ADAPTIVE;const{rateLimiter:t}=r??{};this.rateLimiter=t??new kr,this.standardRetryStrategy=new Oe(e)}async acquireInitialRetryToken(e){return await this.rateLimiter.getSendToken(),this.standardRetryStrategy.acquireInitialRetryToken(e)}async refreshRetryTokenForRetry(e,r){return this.rateLimiter.updateClientSendingRate(r),this.standardRetryStrategy.refreshRetryTokenForRetry(e,r)}recordSuccess(e){this.rateLimiter.updateClientSendingRate({}),this.standardRetryStrategy.recordSuccess(e)}}var $r,_f=new Uint8Array(16);function jt(){if(!$r){if($r=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!$r)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}return $r(_f)}function qn(e,r=0){return O[e[r+0]]+O[e[r+1]]+O[e[r+2]]+O[e[r+3]]+"-"+O[e[r+4]]+O[e[r+5]]+"-"+O[e[r+6]]+O[e[r+7]]+"-"+O[e[r+8]]+O[e[r+9]]+"-"+O[e[r+10]]+O[e[r+11]]+O[e[r+12]]+O[e[r+13]]+O[e[r+14]]+O[e[r+15]]}var O=[];for(let e=0;e<256;++e)O.push((e+256).toString(16).slice(1));var Bf=typeof crypto!=="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),es={randomUUID:Bf};function Gf(e,r,t){if(es.randomUUID&&!r&&!e)return es.randomUUID();e=e||{};const s=e.random||(e.rng||jt)();if(s[6]=s[6]&15|64,s[8]=s[8]&63|128,r){t=t||0;for(let n=0;n<16;++n)r[t+n]=s[n];return r}return qn(s)}var qe=Gf;var rs=(e)=>{if(e instanceof Error)return e;if(e instanceof Object)return Object.assign(new Error,e);if(typeof e==="string")return new Error(e);return new Error(`AWS SDK error wrapper for ${e}`)};var Dr=(e)=>{const{retryStrategy:r}=e,t=F(e.maxAttempts??V);return{...e,maxAttempts:t,retryStrategy:async()=>{if(r)return r;if(await F(e.retryMode)()===_.ADAPTIVE)return new Zt(t);return new Oe(t)}}};class ge{trace(){}debug(){}info(){}warn(){}error(){}}var ye=(e,r)=>{const t=[];if(e)t.push(e);if(r)for(let s of r)t.push(s);return t},oe=(e,r)=>{return`${e||"anonymous"}${r&&r.length>0?` (a.k.a. ${r.join(",")})`:""}`},ke=()=>{let e=[],r=[],t=!1;const s=new Set,n=(l)=>l.sort((d,m)=>vn[m.step]-vn[d.step]||Vn[m.priority||"normal"]-Vn[d.priority||"normal"]),i=(l)=>{let d=!1;const m=(g)=>{const w=ye(g.name,g.aliases);if(w.includes(l)){d=!0;for(let y of w)s.delete(y);return!1}return!0};return e=e.filter(m),r=r.filter(m),d},c=(l)=>{let d=!1;const m=(g)=>{if(g.middleware===l){d=!0;for(let w of ye(g.name,g.aliases))s.delete(w);return!1}return!0};return e=e.filter(m),r=r.filter(m),d},o=(l)=>{return e.forEach((d)=>{l.add(d.middleware,{...d})}),r.forEach((d)=>{l.addRelativeTo(d.middleware,{...d})}),l.identifyOnResolve?.(h.identifyOnResolve()),l},a=(l)=>{const d=[];return l.before.forEach((m)=>{if(m.before.length===0&&m.after.length===0)d.push(m);else d.push(...a(m))}),d.push(l),l.after.reverse().forEach((m)=>{if(m.before.length===0&&m.after.length===0)d.push(m);else d.push(...a(m))}),d},f=(l=!1)=>{const d=[],m=[],g={};return e.forEach((y)=>{const p={...y,before:[],after:[]};for(let E of ye(p.name,p.aliases))g[E]=p;d.push(p)}),r.forEach((y)=>{const p={...y,before:[],after:[]};for(let E of ye(p.name,p.aliases))g[E]=p;m.push(p)}),m.forEach((y)=>{if(y.toMiddleware){const p=g[y.toMiddleware];if(p===void 0){if(l)return;throw new Error(`${y.toMiddleware} is not found when adding ${oe(y.name,y.aliases)} middleware ${y.relation} ${y.toMiddleware}`)}if(y.relation==="after")p.after.push(y);if(y.relation==="before")p.before.push(y)}}),n(d).map(a).reduce((y,p)=>{return y.push(...p),y},[])},h={add:(l,d={})=>{const{name:m,override:g,aliases:w}=d,y={step:"initialize",priority:"normal",middleware:l,...d},p=ye(m,w);if(p.length>0){if(p.some((E)=>s.has(E))){if(!g)throw new Error(`Duplicate middleware name '${oe(m,w)}'`);for(let E of p){const P=e.findIndex((te)=>te.name===E||te.aliases?.some((Me)=>Me===E));if(P===-1)continue;const I=e[P];if(I.step!==y.step||y.priority!==I.priority)throw new Error(`"${oe(I.name,I.aliases)}" middleware with ${I.priority} priority in ${I.step} step cannot be overridden by "${oe(m,w)}" middleware with ${y.priority} priority in ${y.step} step.`);e.splice(P,1)}}for(let E of p)s.add(E)}e.push(y)},addRelativeTo:(l,d)=>{const{name:m,override:g,aliases:w}=d,y={middleware:l,...d},p=ye(m,w);if(p.length>0){if(p.some((E)=>s.has(E))){if(!g)throw new Error(`Duplicate middleware name '${oe(m,w)}'`);for(let E of p){const P=r.findIndex((te)=>te.name===E||te.aliases?.some((Me)=>Me===E));if(P===-1)continue;const I=r[P];if(I.toMiddleware!==y.toMiddleware||I.relation!==y.relation)throw new Error(`"${oe(I.name,I.aliases)}" middleware ${I.relation} "${I.toMiddleware}" middleware cannot be overridden by "${oe(m,w)}" middleware ${y.relation} "${y.toMiddleware}" middleware.`);r.splice(P,1)}}for(let E of p)s.add(E)}r.push(y)},clone:()=>o(ke()),use:(l)=>{l.applyToStack(h)},remove:(l)=>{if(typeof l==="string")return i(l);else return c(l)},removeByTag:(l)=>{let d=!1;const m=(g)=>{const{tags:w,name:y,aliases:p}=g;if(w&&w.includes(l)){const E=ye(y,p);for(let P of E)s.delete(P);return d=!0,!1}return!0};return e=e.filter(m),r=r.filter(m),d},concat:(l)=>{const d=o(ke());return d.use(l),d.identifyOnResolve(t||d.identifyOnResolve()||(l.identifyOnResolve?.()??!1)),d},applyToStack:o,identify:()=>{return f(!0).map((l)=>{const d=l.step??l.relation+" "+l.toMiddleware;return oe(l.name,l.aliases)+" - "+d})},identifyOnResolve(l){if(typeof l==="boolean")t=l;return t},resolve:(l,d)=>{for(let m of f().map((g)=>g.middleware).reverse())l=m(l,d);if(t)console.log(h.identify());return l}};return h},vn={initialize:5,serialize:4,build:3,finalizeRequest:2,deserialize:1},Vn={high:3,normal:2,low:1};class ve{constructor(e){this.middlewareStack=ke(),this.config=e}send(e,r,t){const s=typeof r!=="function"?r:void 0,n=typeof r==="function"?r:t,i=e.resolveMiddleware(this.middlewareStack,this.config,s);if(n)i(e).then((c)=>n(null,c.output),(c)=>n(c)).catch(()=>{});else return i(e).then((c)=>c.output)}destroy(){if(this.config.requestHandler.destroy)this.config.requestHandler.destroy()}}var j={},we=new Array(64);for(let e=0,r="A".charCodeAt(0),t="Z".charCodeAt(0);e+r<=t;e++){const s=String.fromCharCode(e+r);j[s]=e,we[e]=s}for(let e=0,r="a".charCodeAt(0),t="z".charCodeAt(0);e+r<=t;e++){const s=String.fromCharCode(e+r),n=e+26;j[s]=n,we[n]=s}for(let e=0;e<10;e++){j[e.toString(10)]=e+52;const r=e.toString(10),t=e+52;j[r]=t,we[t]=r}j["+"]=62;we[62]="+";j["/"]=63;we[63]="/";var ae=6,pe=8,Yn=63;var fe=(e)=>{let r=e.length/4*3;if(e.slice(-2)==="==")r-=2;else if(e.slice(-1)==="=")r--;const t=new ArrayBuffer(r),s=new DataView(t);for(let n=0;n<e.length;n+=4){let i=0,c=0;for(let f=n,h=n+3;f<=h;f++)if(e[f]!=="="){if(!(e[f]in j))throw new TypeError(`Invalid character ${e[f]} in base64 string.`);i|=j[e[f]]<<(h-f)*ae,c+=ae}else i>>=ae;const o=n/4*3;i>>=c%pe;const a=Math.floor(c/pe);for(let f=0;f<a;f++){const h=(a-f-1)*pe;s.setUint8(o+f,(i&255<<h)>>h)}}return new Uint8Array(t)};var $=(e)=>new TextEncoder().encode(e);var ce=(e)=>{if(typeof e==="string")return $(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(e)};var Se=(e)=>{if(typeof e==="string")return e;if(typeof e!=="object"||typeof e.byteOffset!=="number"||typeof e.byteLength!=="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return new TextDecoder("utf-8").decode(e)};function Ee(e){let r;if(typeof e==="string")r=$(e);else r=e;const t=typeof r==="object"&&typeof r.length==="number",s=typeof r==="object"&&typeof r.byteOffset==="number"&&typeof r.byteLength==="number";if(!t&&!s)throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");let n="";for(let i=0;i<r.length;i+=3){let c=0,o=0;for(let f=i,h=Math.min(i+3,r.length);f<h;f++)c|=r[f]<<(h-f-1)*pe,o+=pe;const a=Math.ceil(o/ae);c<<=a*ae-o;for(let f=1;f<=a;f++){const h=(a-f)*ae;n+=we[(c&Yn<<h)>>h]}n+="==".slice(0,4-a)}return n}function Kn(e,r="utf-8"){if(r==="base64")return Ee(e);return Se(e)}function Xn(e,r){if(r==="base64")return ee.mutate(fe(e));return ee.mutate($(e))}class ee extends Uint8Array{static fromString(e,r="utf-8"){switch(typeof e){case"string":return Xn(e,r);default:throw new Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(e){return Object.setPrototypeOf(e,ee.prototype),e}transformToString(e="utf-8"){return Kn(this,e)}}var B=(e)=>encodeURIComponent(e).replace(/[!'()*]/g,zf),zf=(e)=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`;function Qn(e){const r=[];for(let t of Object.keys(e).sort()){const s=e[t];if(t=B(t),Array.isArray(s))for(let n=0,i=s.length;n<i;n++)r.push(`${t}=${B(s[n])}`);else{let n=t;if(s||typeof s==="string")n+=`=${B(s)}`;r.push(n)}}return r.join("&")}function Jn(e=0){return new Promise((r,t)=>{if(e)setTimeout(()=>{const s=new Error(`Request did not complete within ${e} ms`);s.name="TimeoutError",t(s)},e)})}var ts={supported:void 0};class Fe{static create(e){if(typeof e?.handle==="function")return e;return new Fe(e)}constructor(e){if(typeof e==="function")this.configProvider=e().then((r)=>r||{});else this.config=e??{},this.configProvider=Promise.resolve(this.config);if(ts.supported===void 0)ts.supported=Boolean(typeof Request!=="undefined"&&"keepalive"in new Request("https://[::1]"))}destroy(){}async handle(e,{abortSignal:r}={}){if(!this.config)this.config=await this.configProvider;const t=this.config.requestTimeout,s=this.config.keepAlive===!0,n=this.config.credentials;if(r?.aborted){const y=new Error("Request aborted");return y.name="AbortError",Promise.reject(y)}let i=e.path;const c=Qn(e.query||{});if(c)i+=`?${c}`;if(e.fragment)i+=`#${e.fragment}`;let o="";if(e.username!=null||e.password!=null){const y=e.username??"",p=e.password??"";o=`${y}:${p}@`}const{port:a,method:f}=e,h=`${e.protocol}//${o}${e.hostname}${a?`:${a}`:""}${i}`,l=f==="GET"||f==="HEAD"?void 0:e.body,d={body:l,headers:new Headers(e.headers),method:f,credentials:n};if(l)d.duplex="half";if(typeof AbortController!=="undefined")d.signal=r;if(ts.supported)d.keepalive=s;let m=()=>{};const g=new Request(h,d),w=[fetch(g).then((y)=>{const p=y.headers,E={};for(let I of p.entries())E[I[0]]=I[1];if(y.body==null)return y.blob().then((I)=>({response:new Q({headers:E,reason:y.statusText,statusCode:y.status,body:I})}));return{response:new Q({headers:E,reason:y.statusText,statusCode:y.status,body:y.body})}}),Jn(t)];if(r)w.push(new Promise((y,p)=>{const E=()=>{const P=new Error("Request aborted");P.name="AbortError",p(P)};if(typeof r.addEventListener==="function"){const P=r;P.addEventListener("abort",E,{once:!0}),m=()=>P.removeEventListener("abort",E)}else r.onabort=E}));return Promise.race(w).finally(m)}updateHttpClientConfig(e,r){this.config=void 0,this.configProvider=this.configProvider.then((t)=>{return t[e]=r,t})}httpHandlerConfigs(){return this.config??{}}}async function Hf(e){const r=await qf(e),t=fe(r);return new Uint8Array(t)}async function Wf(e){const r=[],t=e.getReader();let s=!1,n=0;while(!s){const{done:o,value:a}=await t.read();if(a)r.push(a),n+=a.length;s=o}const i=new Uint8Array(n);let c=0;for(let o of r)i.set(o,c),c+=o.length;return i}function qf(e){return new Promise((r,t)=>{const s=new FileReader;s.onloadend=()=>{if(s.readyState!==2)return t(new Error("Reader aborted too early"));const n=s.result??"",i=n.indexOf(","),c=i>-1?i+1:n.length;r(n.substring(c))},s.onabort=()=>t(new Error("Read aborted")),s.onerror=()=>t(s.error),s.readAsDataURL(e)})}var Ve=(e)=>{if(typeof Blob==="function"&&e instanceof Blob)return Hf(e);return Wf(e)};function Ur(e){if(e.length%2!==0)throw new Error("Hex encoded strings must have an even number length");const r=new Uint8Array(e.length/2);for(let t=0;t<e.length;t+=2){const s=e.slice(t,t+2).toLowerCase();if(s in ss)r[t/2]=ss[s];else throw new Error(`Cannot decode unrecognized sequence ${s} as hexadecimal`)}return r}function N(e){let r="";for(let t=0;t<e.byteLength;t++)r+=Zn[e[t]];return r}var Zn={},ss={};for(let e=0;e<256;e++){let r=e.toString(16).toLowerCase();if(r.length===1)r=`0${r}`;Zn[e]=r,ss[r]=e}var Ye=async(e=new Uint8Array,r)=>{if(e instanceof Uint8Array)return ee.mutate(e);if(!e)return ee.mutate(new Uint8Array);const t=r.streamCollector(e);return ee.mutate(await t)};class G{constructor(){this.middlewareStack=ke()}static classBuilder(){return new jn}resolveMiddlewareWithContext(e,r,t,{middlewareFn:s,clientName:n,commandName:i,inputFilterSensitiveLog:c,outputFilterSensitiveLog:o,smithyContext:a,additionalContext:f,CommandCtor:h}){for(let w of s.bind(this)(h,e,r,t))this.middlewareStack.use(w);const l=e.concat(this.middlewareStack),{logger:d}=r,m={logger:d,clientName:n,commandName:i,inputFilterSensitiveLog:c,outputFilterSensitiveLog:o,[se]:{commandInstance:this,...a},...f},{requestHandler:g}=r;return l.resolve((w)=>g.handle(w.request,t||{}),m)}}class jn{constructor(){this._init=()=>{},this._ep={},this._middlewareFn=()=>[],this._commandName="",this._clientName="",this._additionalContext={},this._smithyContext={},this._inputFilterSensitiveLog=(e)=>e,this._outputFilterSensitiveLog=(e)=>e,this._serializer=null,this._deserializer=null}init(e){this._init=e}ep(e){return this._ep=e,this}m(e){return this._middlewareFn=e,this}s(e,r,t={}){return this._smithyContext={service:e,operation:r,...t},this}c(e={}){return this._additionalContext=e,this}n(e,r){return this._clientName=e,this._commandName=r,this}f(e=(t)=>t,r=(t)=>t){return this._inputFilterSensitiveLog=e,this._outputFilterSensitiveLog=r,this}ser(e){return this._serializer=e,this}de(e){return this._deserializer=e,this}build(){const e=this;let r;return r=class extends G{static getEndpointParameterInstructions(){return e._ep}constructor(...[t]){super();this.serialize=e._serializer,this.deserialize=e._deserializer,this.input=t??{},e._init(this)}resolveMiddleware(t,s,n){return this.resolveMiddlewareWithContext(t,s,n,{CommandCtor:r,middlewareFn:e._middlewareFn,clientName:e._clientName,commandName:e._commandName,inputFilterSensitiveLog:e._inputFilterSensitiveLog,outputFilterSensitiveLog:e._outputFilterSensitiveLog,smithyContext:e._smithyContext,additionalContext:e._additionalContext})}}}}var Ke="***SensitiveInformation***";var vf=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string"){const r=parseFloat(e);if(!Number.isNaN(r)){if(String(r)!==String(e))oi.warn(ii(`Expected number but observed string: ${e}`));return r}}if(typeof e==="number")return e;throw new TypeError(`Expected number, got ${typeof e}: ${e}`)},Vf=Math.ceil(340282346638528860000000000000000000000),ns=(e)=>{const r=vf(e);if(r!==void 0&&!Number.isNaN(r)&&r!==1/0&&r!==-1/0){if(Math.abs(r)>Vf)throw new TypeError(`Expected 32-bit float, got ${e}`)}return r},Yf=(e)=>{if(e===null||e===void 0)return;if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw new TypeError(`Expected integer, got ${typeof e}: ${e}`)};var br=(e)=>is(e,32),ei=(e)=>is(e,16),ri=(e)=>is(e,8),is=(e,r)=>{const t=Yf(e);if(t!==void 0&&Kf(t,r)!==t)throw new TypeError(`Expected ${r}-bit integer, got ${e}`);return t},Kf=(e,r)=>{switch(r){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},de=(e,r)=>{if(e===null||e===void 0){if(r)throw new TypeError(`Expected a non-null value for ${r}`);throw new TypeError("Expected a non-null value")}return e},Xe=(e)=>{if(e===null||e===void 0)return;if(typeof e==="object"&&!Array.isArray(e))return e;const r=Array.isArray(e)?"array":typeof e;throw new TypeError(`Expected object, got ${r}: ${e}`)},S=(e)=>{if(e===null||e===void 0)return;if(typeof e==="string")return e;if(["boolean","number","bigint"].includes(typeof e))return oi.warn(ii(`Expected string, got ${typeof e}: ${e}`)),String(e);throw new TypeError(`Expected string, got ${typeof e}: ${e}`)};var ti=(e)=>{if(typeof e=="string")return ns(os(e));return ns(e)},Xf=/(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g,os=(e)=>{const r=e.match(Xf);if(r===null||r[0].length!==e.length)throw new TypeError("Expected real number, got implicit NaN");return parseFloat(e)};var as=(e)=>{if(typeof e=="string")return Qf(e);return ns(e)},Qf=(e)=>{switch(e){case"NaN":return NaN;case"Infinity":return 1/0;case"-Infinity":return-1/0;default:throw new Error(`Unable to parse float value: ${e}`)}};var si=(e)=>{if(typeof e==="string")return ei(os(e));return ei(e)},ni=(e)=>{if(typeof e==="string")return ri(os(e));return ri(e)},ii=(e)=>{return String(new TypeError(e).stack||e).split("\n").slice(0,5).filter((r)=>!r.includes("stackTraceWarning")).join("\n")},oi={warn:console.warn};var Jf=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],ZE=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);var Zf=new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(([-+]\d{2}\:\d{2})|[zZ])$/),Lr=(e)=>{if(e===null||e===void 0)return;if(typeof e!=="string")throw new TypeError("RFC-3339 date-times must be expressed as strings");const r=Zf.exec(e);if(!r)throw new TypeError("Invalid RFC-3339 date-time value");const[t,s,n,i,c,o,a,f,h]=r,l=si(ai(s)),d=Qe(n,"month",1,12),m=Qe(i,"day",1,31),g=jf(l,d,m,{hours:c,minutes:o,seconds:a,fractionalMilliseconds:f});if(h.toUpperCase()!="Z")g.setTime(g.getTime()-nc(h));return g},jE=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$/),eA=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$/),rA=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})$/);var jf=(e,r,t,s)=>{const n=r-1;return rc(e,n,t),new Date(Date.UTC(e,n,t,Qe(s.hours,"hour",0,23),Qe(s.minutes,"minute",0,59),Qe(s.seconds,"seconds",0,60),sc(s.fractionalMilliseconds)))};var ec=[31,28,31,30,31,30,31,31,30,31,30,31],rc=(e,r,t)=>{let s=ec[r];if(r===1&&tc(e))s=29;if(t>s)throw new TypeError(`Invalid day for ${Jf[r]} in ${e}: ${t}`)},tc=(e)=>{return e%4===0&&(e%100!==0||e%400===0)},Qe=(e,r,t,s)=>{const n=ni(ai(e));if(n<t||n>s)throw new TypeError(`${r} must be between ${t} and ${s}, inclusive`);return n},sc=(e)=>{if(e===null||e===void 0)return 0;return ti("0."+e)*1000},nc=(e)=>{const r=e[0];let t=1;if(r=="+")t=1;else if(r=="-")t=-1;else throw new TypeError(`Offset direction, ${r}, must be "+" or "-"`);const s=Number(e.substring(1,3)),n=Number(e.substring(4,6));return t*(s*60+n)*60*1000},ai=(e)=>{let r=0;while(r<e.length-1&&e.charAt(r)==="0")r++;if(r===0)return e;return e.slice(r)};class xe extends Error{constructor(e){super(e.message);Object.setPrototypeOf(this,xe.prototype),this.name=e.name,this.$fault=e.$fault,this.$metadata=e.$metadata}}var T=(e,r={})=>{Object.entries(r).filter(([,s])=>s!==void 0).forEach(([s,n])=>{if(e[s]==null||e[s]==="")e[s]=n});const t=e.message||e.Message||"UnknownError";return e.message=t,delete e.Message,e};var ic=({output:e,parsedBody:r,exceptionCtor:t,errorCode:s})=>{const n=oc(e),i=n.httpStatusCode?n.httpStatusCode+"":void 0,c=new t({name:r?.code||r?.Code||s||i||"UnknownError",$fault:"client",$metadata:n});throw T(c,r)},_r=(e)=>{return({output:r,parsedBody:t,errorCode:s})=>{ic({output:r,parsedBody:t,exceptionCtor:e,errorCode:s})}},oc=(e)=>({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"]});var Br=(e)=>{switch(e){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:30000};default:return{}}};var fi=(e)=>{const r=[];for(let t in Pe){const s=Pe[t];if(e[s]===void 0)continue;r.push({algorithmId:()=>s,checksumConstructor:()=>e[s]})}return{_checksumAlgorithms:r,addChecksumAlgorithm(t){this._checksumAlgorithms.push(t)},checksumAlgorithms(){return this._checksumAlgorithms}}},ci=(e)=>{const r={};return e.checksumAlgorithms().forEach((t)=>{r[t.algorithmId()]=t.checksumConstructor()}),r};var di=(e)=>{let r=e.retryStrategy;return{setRetryStrategy(t){r=t},retryStrategy(){return r}}},li=(e)=>{const r={};return r.retryStrategy=e.retryStrategy(),r};var Gr=(e)=>{return{...fi(e),...di(e)}};var zr=(e)=>{return{...ci(e),...li(e)}};function fs(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(r){return"%"+r.charCodeAt(0).toString(16).toUpperCase()})}var cs=function(){const e=Object.getPrototypeOf(this).constructor,t=new(Function.bind.apply(String,[null,...arguments]));return Object.setPrototypeOf(t,e.prototype),t};cs.prototype=Object.create(String.prototype,{constructor:{value:cs,enumerable:!1,writable:!0,configurable:!0}});Object.setPrototypeOf(cs,String);function A(e,r,t){let s,n,i;if(typeof r==="undefined"&&typeof t==="undefined")s={},i=e;else if(s=e,typeof r==="function")return n=r,i=t,ac(s,n,i);else i=r;for(let c of Object.keys(i)){if(!Array.isArray(i[c])){s[c]=i[c];continue}mi(s,null,i,c)}return s}var R=(e,r)=>{const t={};for(let s in r)mi(t,e,r,s);return t},ac=(e,r,t)=>{return A(e,Object.entries(t).reduce((s,[n,i])=>{if(Array.isArray(i))s[n]=i;else if(typeof i==="function")s[n]=[r,i()];else s[n]=[r,i];return s},{}))},mi=(e,r,t,s)=>{if(r!==null){let c=t[s];if(typeof c==="function")c=[,c];const[o=fc,a=cc,f=s]=c;if(typeof o==="function"&&o(r[f])||typeof o!=="function"&&!!o)e[s]=a(r[f]);return}let[n,i]=t[s];if(typeof i==="function"){let c;const o=n===void 0&&(c=i())!=null,a=typeof n==="function"&&!!n(void 0)||typeof n!=="function"&&!!n;if(o)e[s]=c;else if(a)e[s]=i()}else{const c=n===void 0&&i!=null,o=typeof n==="function"&&!!n(i)||typeof n!=="function"&&!!n;if(c||o)e[s]=i}},fc=(e)=>e!=null,cc=(e)=>e;var hi=(e,r,t,s,n,i)=>{if(r!=null&&r[t]!==void 0){const c=s();if(c.length<=0)throw new Error("Empty value provided for input HTTP label: "+t+".");e=e.replace(n,i?c.split("/").map((o)=>fs(o)).join("/"):fs(c))}else throw new Error("No value provided for input HTTP label: "+t+".");return e};var k=(e)=>{if(e==null)return{};if(Array.isArray(e))return e.filter((r)=>r!=null).map(k);if(typeof e==="object"){const r={};for(let t of Object.keys(e)){if(e[t]==null)continue;r[t]=k(e[t])}return r}return e};var gi=(e)=>e?.body instanceof ReadableStream;var dc=(e)=>(r,t)=>async(s)=>{let n=await e.retryStrategy();const i=await e.maxAttempts();if(lc(n)){n=n;let c=await n.acquireInitialRetryToken(t.partition_id),o=new Error,a=0,f=0;const{request:h}=s,l=u.isInstance(h);if(l)h.headers[xr]=qe();while(!0)try{if(l)h.headers[Cr]=`attempt=${a+1}; max=${i}`;const{response:d,output:m}=await r(s);return n.recordSuccess(c),m.$metadata.attempts=a+1,m.$metadata.totalRetryDelay=f,{response:d,output:m}}catch(d){const m=mc(d);if(o=rs(d),l&&gi(h))throw(t.logger instanceof ge?console:t.logger)?.warn("An error was encountered in a non-retryable streaming request."),o;try{c=await n.refreshRetryTokenForRetry(c,m)}catch(w){if(!o.$metadata)o.$metadata={};throw o.$metadata.attempts=a+1,o.$metadata.totalRetryDelay=f,o}a=c.getRetryCount();const g=c.getRetryDelay();f+=g,await new Promise((w)=>setTimeout(w,g))}}else{if(n=n,n?.mode)t.userAgent=[...t.userAgent||[],["cfg/retry-mode",n.mode]];return n.retry(r,s)}},lc=(e)=>typeof e.acquireInitialRetryToken!=="undefined"&&typeof e.refreshRetryTokenForRetry!=="undefined"&&typeof e.recordSuccess!=="undefined",mc=(e)=>{const r={error:e,errorType:hc(e)},t=gc(e.$response);if(t)r.retryAfterHint=t;return r},hc=(e)=>{if(Ne(e))return"THROTTLING";if(Or(e))return"TRANSIENT";if(Hn(e))return"SERVER_ERROR";return"CLIENT_ERROR"},ds={name:"retryMiddleware",tags:["RETRY"],step:"finalizeRequest",priority:"high",override:!0},Hr=(e)=>({applyToStack:(r)=>{r.add(dc(e),ds)}}),gc=(e)=>{if(!Q.isInstance(e))return;const r=Object.keys(e.headers).find((i)=>i.toLowerCase()==="retry-after");if(!r)return;const t=e.headers[r],s=Number(t);if(!Number.isNaN(s))return new Date(s*1000);return new Date(t)};var yc={step:"finalizeRequest",tags:["HTTP_SIGNING"],name:"httpSigningMiddleware",aliases:["apiKeyMiddleware","tokenMiddleware","awsAuthMiddleware"],override:!0,relation:"after",toMiddleware:ds.name},Wr=(e)=>({applyToStack:(r)=>{r.addRelativeTo(Ln(e),yc)}});class Je{constructor(e){this.authSchemes=new Map;for(let[r,t]of Object.entries(e))if(t!==void 0)this.authSchemes.set(r,t)}getIdentityProvider(e){return this.authSchemes.get(e)}}var wc=(e)=>(r)=>ls(r)&&r.expiration.getTime()-Date.now()<e;var yi=wc(300000),ls=(e)=>e.expiration!==void 0,wi=(e,r,t)=>{if(e===void 0)return;const s=typeof e!=="function"?async()=>Promise.resolve(e):e;let n,i,c,o=!1;const a=async(f)=>{if(!i)i=s(f);try{n=await i,c=!0,o=!1}finally{i=void 0}return n};if(r===void 0)return async(f)=>{if(!c||f?.forceRefresh)n=await a(f);return n};return async(f)=>{if(!c||f?.forceRefresh)n=await a(f);if(o)return n;if(!t(n))return o=!0,n;if(r(n))return await a(f),n;return n}};var Ze=(e)=>{if(typeof e==="function")return e;const r=Promise.resolve(e);return()=>r};function Ae(e,r){return new pi(e,r)}class pi{constructor(e,r){this.input=e,this.context=r,this.query={},this.method="",this.headers={},this.path="",this.body=null,this.hostname="",this.resolvePathStack=[]}async build(){const{hostname:e,protocol:r="https",port:t,path:s}=await this.context.endpoint();this.path=s;for(let n of this.resolvePathStack)n(this.path);return new u({protocol:r,hostname:this.hostname||e,port:t,method:this.method,path:this.path,query:this.query,body:this.body,headers:this.headers})}hn(e){return this.hostname=e,this}bp(e){return this.resolvePathStack.push((r)=>{this.path=`${r?.endsWith("/")?r.slice(0,-1):r||""}`+e}),this}p(e,r,t,s){return this.resolvePathStack.push((n)=>{this.path=hi(n,this.input,e,r,t,s)}),this}h(e){return this.headers=e,this}q(e){return this.query=e,this}b(e){return this.body=e,this}m(e){return this.method=e,this}}function pc(e){return(r)=>async(t)=>{const s=t.request;if(u.isInstance(s)){const{body:n,headers:i}=s;if(n&&Object.keys(i).map((c)=>c.toLowerCase()).indexOf(Si)===-1)try{const c=e(n);s.headers={...s.headers,[Si]:String(c)}}catch(c){}}return r({...t,request:s})}}var Si="content-length",Sc={step:"build",tags:["SET_CONTENT_LENGTH","CONTENT_LENGTH"],name:"contentLengthMiddleware",override:!0},qr=(e)=>({applyToStack:(r)=>{r.add(pc(e.bodyLengthChecker),Sc)}});var ms=(e)=>Q.isInstance(e)?e.headers?.date??e.headers?.Date:void 0;var vr=(e)=>new Date(Date.now()+e);var Ei=(e,r)=>Math.abs(vr(r).getTime()-e)>=300000;var hs=(e,r)=>{const t=Date.parse(e);if(Ei(t,r))return t-Date.now();return r};var je=(e,r)=>{if(!r)throw new Error(`Property \`${e}\` is not resolved for AWS SDK SigV4Auth`);return r},Ai=async(e)=>{const r=je("context",e.context),t=je("config",e.config),s=r.endpointV2?.properties?.authSchemes?.[0],i=await je("signer",t.signer)(s),c=e?.signingRegion,o=e?.signingRegionSet,a=e?.signingName;return{config:t,signer:i,signingRegion:c,signingRegionSet:o,signingName:a}};class Ce{async sign(e,r,t){if(!u.isInstance(e))throw new Error("The request is not an instance of `HttpRequest` and cannot be signed");const s=await Ai(t),{config:n,signer:i}=s;let{signingRegion:c,signingName:o}=s;const a=t.context;if(a?.authSchemes?.length??0>1){const[h,l]=a.authSchemes;if(h?.name==="sigv4a"&&l?.name==="sigv4")c=l?.signingRegion??c,o=l?.signingName??o}return await i.sign(e,{signingDate:vr(n.systemClockOffset),signingRegion:c,signingService:o})}errorHandler(e){return(r)=>{const t=r.ServerTime??ms(r.$response);if(t){const s=je("config",e.config),n=s.systemClockOffset;if(s.systemClockOffset=hs(t,s.systemClockOffset),s.systemClockOffset!==n&&r.$metadata)r.$metadata.clockSkewCorrected=!0}throw r}}successHandler(e,r){const t=ms(e);if(t){const s=je("config",r.config);s.systemClockOffset=hs(t,s.systemClockOffset)}}}var ui=(e,r,t)=>{let s,n,i,c=!1;const o=async()=>{if(!n)n=e();try{s=await n,i=!0,c=!1}finally{n=void 0}return s};if(r===void 0)return async(a)=>{if(!i||a?.forceRefresh)s=await o();return s};return async(a)=>{if(!i||a?.forceRefresh)s=await o();if(c)return s;if(t&&!t(s))return c=!0,s;if(r(s))return await o(),s;return s}};var Mi="X-Amz-Algorithm",Ti="X-Amz-Credential",Pi="X-Amz-Date",Ii="X-Amz-SignedHeaders",Ni="X-Amz-Expires",Oi="X-Amz-Signature",ki="X-Amz-Security-Token";var Fi="authorization",gs="X-Amz-Date".toLowerCase();var xi=["authorization",gs,"date"],Ci="X-Amz-Signature".toLowerCase(),er="x-amz-content-sha256",$i="X-Amz-Security-Token".toLowerCase();var Di={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},Ui=/^proxy-/,bi=/^sec-/;var Vr="AWS4-HMAC-SHA256";var Li="AWS4-HMAC-SHA256-PAYLOAD",_i="UNSIGNED-PAYLOAD",Bi=50,ys="aws4_request",Gi=604800;var Yr={},ws=[],Kr=(e,r,t)=>`${e}/${r}/${t}/${ys}`,Hi=async(e,r,t,s,n)=>{const i=await zi(e,r.secretAccessKey,r.accessKeyId),c=`${t}:${s}:${n}:${N(i)}:${r.sessionToken}`;if(c in Yr)return Yr[c];ws.push(c);while(ws.length>Bi)delete Yr[ws.shift()];let o=`AWS4${r.secretAccessKey}`;for(let a of[t,s,n,ys])o=await zi(e,o,a);return Yr[c]=o};var zi=(e,r,t)=>{const s=new e(r);return s.update(ce(t)),s.digest()};var Xr=({headers:e},r,t)=>{const s={};for(let n of Object.keys(e).sort()){if(e[n]==null)continue;const i=n.toLowerCase();if(i in Di||r?.has(i)||Ui.test(i)||bi.test(i)){if(!t||t&&!t.has(i))continue}s[i]=e[n].trim().replace(/\s+/g," ")}return s};var ps=({query:e={}})=>{const r=[],t={};for(let s of Object.keys(e).sort()){if(s.toLowerCase()===Ci)continue;r.push(s);const n=e[s];if(typeof n==="string")t[s]=`${B(s)}=${B(n)}`;else if(Array.isArray(n))t[s]=n.slice(0).reduce((i,c)=>i.concat([`${B(s)}=${B(c)}`]),[]).sort().join("&")}return r.map((s)=>t[s]).filter((s)=>s).join("&")};var Wi=(e)=>typeof ArrayBuffer==="function"&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)==="[object ArrayBuffer]";var rr=async({headers:e,body:r},t)=>{for(let s of Object.keys(e))if(s.toLowerCase()===er)return e[s];if(r==null)return"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";else if(typeof r==="string"||ArrayBuffer.isView(r)||Wi(r)){const s=new t;return s.update(ce(r)),N(await s.digest())}return _i};function vi(e){for(let r=0;r<8;r++)e[r]^=255;for(let r=7;r>-1;r--)if(e[r]++,e[r]!==0)break}class Ss{format(e){const r=[];for(let n of Object.keys(e)){const i=$(n);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[n]))}const t=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0));let s=0;for(let n of r)t.set(n,s),s+=n.byteLength;return t}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 r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":const t=new DataView(new ArrayBuffer(5));return t.setUint8(0,4),t.setInt32(1,e.value,!1),new Uint8Array(t.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(n.buffer);return i.set(e.value,3),i;case"string":const c=$(e.value),o=new DataView(new ArrayBuffer(3+c.byteLength));o.setUint8(0,7),o.setUint16(1,c.byteLength,!1);const a=new Uint8Array(o.buffer);return a.set(c,3),a;case"timestamp":const f=new Uint8Array(9);return f[0]=8,f.set(Es.fromNumber(e.value.valueOf()).bytes,1),f;case"uuid":if(!Ec.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const h=new Uint8Array(17);return h[0]=9,h.set(Ur(e.value.replace(/\-/g,"")),1),h}}}var qi;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(qi||(qi={}));var Ec=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;class Es{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776000||e<-9223372036854776000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const r=new Uint8Array(8);for(let t=7,s=Math.abs(Math.round(e));t>-1&&s>0;t--,s/=256)r[t]=s;if(e<0)vi(r);return new Es(r)}valueOf(){const e=this.bytes.slice(0),r=e[0]&128;if(r)vi(e);return parseInt(N(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}var Vi=(e,r)=>{e=e.toLowerCase();for(let t of Object.keys(r))if(e===t.toLowerCase())return!0;return!1};var As=(e,r={})=>{const{headers:t,query:s={}}=u.clone(e);for(let n of Object.keys(t)){const i=n.toLowerCase();if(i.slice(0,6)==="x-amz-"&&!r.unhoistableHeaders?.has(i))s[n]=t[n],delete t[n]}return{...e,headers:t,query:s}};var Qr=(e)=>{e=u.clone(e);for(let r of Object.keys(e.headers))if(xi.indexOf(r.toLowerCase())>-1)delete e.headers[r];return e};var Yi=(e)=>Ac(e).toISOString().replace(/\.\d{3}Z$/,"Z"),Ac=(e)=>{if(typeof e==="number")return new Date(e*1000);if(typeof e==="string"){if(Number(e))return new Date(Number(e)*1000);return new Date(e)}return e};class Zr{constructor({applyChecksum:e,credentials:r,region:t,service:s,sha256:n,uriEscapePath:i=!0}){this.headerFormatter=new Ss,this.service=s,this.sha256=n,this.uriEscapePath=i,this.applyChecksum=typeof e==="boolean"?e:!0,this.regionProvider=F(t),this.credentialProvider=F(r)}async presign(e,r={}){const{signingDate:t=new Date,expiresIn:s=3600,unsignableHeaders:n,unhoistableHeaders:i,signableHeaders:c,signingRegion:o,signingService:a}=r,f=await this.credentialProvider();this.validateResolvedCredentials(f);const h=o??await this.regionProvider(),{longDate:l,shortDate:d}=Jr(t);if(s>Gi)return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future");const m=Kr(d,h,a??this.service),g=As(Qr(e),{unhoistableHeaders:i});if(f.sessionToken)g.query[ki]=f.sessionToken;g.query[Mi]=Vr,g.query[Ti]=`${f.accessKeyId}/${m}`,g.query[Pi]=l,g.query[Ni]=s.toString(10);const w=Xr(g,n,c);return g.query[Ii]=Ki(w),g.query[Oi]=await this.getSignature(l,m,this.getSigningKey(f,h,d,a),this.createCanonicalRequest(g,w,await rr(e,this.sha256))),g}async sign(e,r){if(typeof e==="string")return this.signString(e,r);else if(e.headers&&e.payload)return this.signEvent(e,r);else if(e.message)return this.signMessage(e,r);else return this.signRequest(e,r)}async signEvent({headers:e,payload:r},{signingDate:t=new Date,priorSignature:s,signingRegion:n,signingService:i}){const c=n??await this.regionProvider(),{shortDate:o,longDate:a}=Jr(t),f=Kr(o,c,i??this.service),h=await rr({headers:{},body:r},this.sha256),l=new this.sha256;l.update(e);const d=N(await l.digest()),m=[Li,a,f,s,d,h].join("\n");return this.signString(m,{signingDate:t,signingRegion:c,signingService:i})}async signMessage(e,{signingDate:r=new Date,signingRegion:t,signingService:s}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:r,signingRegion:t,signingService:s,priorSignature:e.priorSignature}).then((i)=>{return{message:e.message,signature:i}})}async signString(e,{signingDate:r=new Date,signingRegion:t,signingService:s}={}){const n=await this.credentialProvider();this.validateResolvedCredentials(n);const i=t??await this.regionProvider(),{shortDate:c}=Jr(r),o=new this.sha256(await this.getSigningKey(n,i,c,s));return o.update(ce(e)),N(await o.digest())}async signRequest(e,{signingDate:r=new Date,signableHeaders:t,unsignableHeaders:s,signingRegion:n,signingService:i}={}){const c=await this.credentialProvider();this.validateResolvedCredentials(c);const o=n??await this.regionProvider(),a=Qr(e),{longDate:f,shortDate:h}=Jr(r),l=Kr(h,o,i??this.service);if(a.headers[gs]=f,c.sessionToken)a.headers[$i]=c.sessionToken;const d=await rr(a,this.sha256);if(!Vi(er,a.headers)&&this.applyChecksum)a.headers[er]=d;const m=Xr(a,s,t),g=await this.getSignature(f,l,this.getSigningKey(c,o,h,i),this.createCanonicalRequest(a,m,d));return a.headers[Fi]=`${Vr} Credential=${c.accessKeyId}/${l}, SignedHeaders=${Ki(m)}, Signature=${g}`,a}createCanonicalRequest(e,r,t){const s=Object.keys(r).sort();return`${e.method}
2
+ ${this.getCanonicalPath(e)}
3
+ ${ps(e)}
4
+ ${s.map((n)=>`${n}:${r[n]}`).join("\n")}
67
5
 
68
- //# debugId=5BD891C214399E2564756E2164756E21
6
+ ${s.join(";")}
7
+ ${t}`}async createStringToSign(e,r,t){const s=new this.sha256;s.update(ce(t));const n=await s.digest();return`${Vr}
8
+ ${e}
9
+ ${r}
10
+ ${N(n)}`}getCanonicalPath({path:e}){if(this.uriEscapePath){const r=[];for(let n of e.split("/")){if(n?.length===0)continue;if(n===".")continue;if(n==="..")r.pop();else r.push(n)}const t=`${e?.startsWith("/")?"/":""}${r.join("/")}${r.length>0&&e?.endsWith("/")?"/":""}`;return B(t).replace(/%2F/g,"/")}return e}async getSignature(e,r,t,s){const n=await this.createStringToSign(e,r,s),i=new this.sha256(await t);return i.update(ce(n)),N(await i.digest())}getSigningKey(e,r,t,s){return Hi(this.sha256,e,t,r,s||this.service)}validateResolvedCredentials(e){if(typeof e!=="object"||typeof e.accessKeyId!=="string"||typeof e.secretAccessKey!=="string")throw new Error("Resolved credential object is not valid")}}var Jr=(e)=>{const r=Yi(e).replace(/[\-:]/g,"");return{longDate:r,shortDate:r.slice(0,8)}},Ki=(e)=>Object.keys(e).sort().join(";");var jr=(e)=>{let r;if(e.credentials)r=wi(e.credentials,yi,ls);if(!r)if(e.credentialDefaultProvider)r=Ze(e.credentialDefaultProvider(Object.assign({},e,{parentClientConfig:e})));else r=async()=>{throw new Error("`credentials` is missing")};const{signingEscapePath:t=!0,systemClockOffset:s=e.systemClockOffset||0,sha256:n}=e;let i;if(e.signer)i=Ze(e.signer);else if(e.regionInfoProvider)i=()=>Ze(e.region)().then(async(c)=>[await e.regionInfoProvider(c,{useFipsEndpoint:await e.useFipsEndpoint(),useDualstackEndpoint:await e.useDualstackEndpoint()})||{},c]).then(([c,o])=>{const{signingRegion:a,signingService:f}=c;e.signingRegion=e.signingRegion||a||o,e.signingName=e.signingName||f||e.serviceId;const h={...e,credentials:r,region:e.signingRegion,service:e.signingName,sha256:n,uriEscapePath:t};return new(e.signerConstructor||Zr)(h)});else i=async(c)=>{c=Object.assign({},{name:"sigv4",signingName:e.signingName||e.defaultSigningName,signingRegion:await Ze(e.region)(),properties:{}},c);const{signingRegion:o,signingName:a}=c;e.signingRegion=e.signingRegion||o,e.signingName=e.signingName||a||e.serviceId;const f={...e,credentials:r,region:e.signingRegion,service:e.signingName,sha256:n,uriEscapePath:t};return new(e.signerConstructor||Zr)(f)};return{...e,systemClockOffset:s,signingEscapePath:t,credentials:r,signer:i}};var Xi=(e,r)=>Ye(e,r).then((t)=>r.utf8Encoder(t));var D=(e,r)=>Xi(e,r).then((t)=>{if(t.length)try{return JSON.parse(t)}catch(s){if(s?.name==="SyntaxError")Object.defineProperty(s,"$responseBodyText",{value:t});throw s}return{}}),et=async(e,r)=>{const t=await D(e,r);return t.message=t.message??t.Message,t},rt=(e,r)=>{const t=(i,c)=>Object.keys(i).find((o)=>o.toLowerCase()===c.toLowerCase()),s=(i)=>{let c=i;if(typeof c==="number")c=c.toString();if(c.indexOf(",")>=0)c=c.split(",")[0];if(c.indexOf(":")>=0)c=c.split(":")[0];if(c.indexOf("#")>=0)c=c.split("#")[1];return c},n=t(e.headers,"x-amzn-errortype");if(n!==void 0)return s(e.headers[n]);if(r.code!==void 0)return s(r.code);if(r.__type!==void 0)return s(r.__type)};function Rc(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"bedrock",region:e.region},propertiesExtractor:(r,t)=>({signingProperties:{config:r,context:t}})}}var Qi=async(e,r,t)=>{return{operation:W(r).operation,region:await F(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},Ji=(e)=>{const r=[];switch(e.operation){default:r.push(Rc(e))}return r},Zi=(e)=>{return{...jr(e)}};var ji=(e)=>{return{...e,useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"bedrock"}},$e={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var eo={name:"@aws-sdk/client-bedrock",description:"AWS SDK for JavaScript Bedrock Client for Node.js, Browser and React Native",version:"3.632.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-bedrock","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo bedrock"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.632.0","@aws-sdk/client-sts":"3.632.0","@aws-sdk/core":"3.629.0","@aws-sdk/credential-provider-node":"3.632.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.632.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.632.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.3.2","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.14","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.1.12","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.14","@smithy/util-defaults-mode-node":"^3.0.14","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2",uuid:"^9.0.1"},devDependencies:{"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96","@types/uuid":"^9.0.4",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-bedrock"}};var Rs=(e)=>new TextEncoder().encode(e);function z(e){if(e instanceof Uint8Array)return e;if(typeof e==="string")return Mc(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT);return new Uint8Array(e)}var Mc=typeof Buffer!=="undefined"&&Buffer.from?function(e){return Buffer.from(e,"utf8")}:Rs;function le(e){if(typeof e==="string")return e.length===0;return e.byteLength===0}function us(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}function Ms(e){if(!Uint32Array.from){var r=new Uint32Array(e.length),t=0;while(t<e.length)r[t]=e[t],t+=1;return r}return Uint32Array.from(e)}var Ts={name:"SHA-256"},Ps={name:"HMAC",hash:Ts},ro=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]);function De(){if(typeof window!=="undefined")return window;else if(typeof self!=="undefined")return self;return Tc}var Tc={};var Is=function(){function e(r){this.toHash=new Uint8Array(0),this.secret=r,this.reset()}return e.prototype.update=function(r){if(le(r))return;var t=z(r),s=new Uint8Array(this.toHash.byteLength+t.byteLength);s.set(this.toHash,0),s.set(t,this.toHash.byteLength),this.toHash=s},e.prototype.digest=function(){var r=this;if(this.key)return this.key.then(function(t){return De().crypto.subtle.sign(Ps,t,r.toHash).then(function(s){return new Uint8Array(s)})});if(le(this.toHash))return Promise.resolve(ro);return Promise.resolve().then(function(){return De().crypto.subtle.digest(Ts,r.toHash)}).then(function(t){return Promise.resolve(new Uint8Array(t))})},e.prototype.reset=function(){var r=this;if(this.toHash=new Uint8Array(0),this.secret&&this.secret!==void 0)this.key=new Promise(function(t,s){De().crypto.subtle.importKey("raw",z(r.secret),Ps,!1,["sign"]).then(t,s)}),this.key.catch(function(){})},e}();function tt(e,r,t,s){function n(i){return i instanceof t?i:new t(function(c){c(i)})}return new(t||(t=Promise))(function(i,c){function o(h){try{f(s.next(h))}catch(l){c(l)}}function a(h){try{f(s.throw(h))}catch(l){c(l)}}function f(h){h.done?i(h.value):n(h.value).then(o,a)}f((s=s.apply(e,r||[])).next())})}function st(e,r){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,n,i,c;return c={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(c[Symbol.iterator]=function(){return this}),c;function o(f){return function(h){return a([f,h])}}function a(f){if(s)throw new TypeError("Generator is already executing.");while(c&&(c=0,f[0]&&(t=0)),t)try{if(s=1,n&&(i=f[0]&2?n.return:f[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,f[1])).done)return i;if(n=0,i)f=[f[0]&2,i.value];switch(f[0]){case 0:case 1:i=f;break;case 4:return t.label++,{value:f[1],done:!1};case 5:t.label++,n=f[1],f=[0];continue;case 7:f=t.ops.pop(),t.trys.pop();continue;default:if((i=t.trys,!(i=i.length>0&&i[i.length-1]))&&(f[0]===6||f[0]===2)){t=0;continue}if(f[0]===3&&(!i||f[1]>i[0]&&f[1]<i[3])){t.label=f[1];break}if(f[0]===6&&t.label<i[1]){t.label=i[1],i=f;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(f);break}if(i[2])t.ops.pop();t.trys.pop();continue}f=r.call(e,t)}catch(h){f=[6,h],n=0}finally{s=i=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function to(e){var r=typeof Symbol==="function"&&Symbol.iterator,t=r&&e[r],s=0;if(t)return t.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&s>=e.length)e=void 0;return{value:e&&e[s++],done:!e}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}var C=64,so=32,no=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]),io=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],oo=Math.pow(2,53)-1;var tr=function(){function e(){this.state=Int32Array.from(io),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(r){if(this.finished)throw new Error("Attempted to update an already finished hash.");var t=0,s=r.byteLength;if(this.bytesHashed+=s,this.bytesHashed*8>oo)throw new Error("Cannot hash more than 2^53 - 1 bits");while(s>0)if(this.buffer[this.bufferLength++]=r[t++],s--,this.bufferLength===C)this.hashBuffer(),this.bufferLength=0},e.prototype.digest=function(){if(!this.finished){var r=this.bytesHashed*8,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),s=this.bufferLength;if(t.setUint8(this.bufferLength++,128),s%C>=C-8){for(var n=this.bufferLength;n<C;n++)t.setUint8(n,0);this.hashBuffer(),this.bufferLength=0}for(var n=this.bufferLength;n<C-8;n++)t.setUint8(n,0);t.setUint32(C-8,Math.floor(r/4294967296),!0),t.setUint32(C-4,r),this.hashBuffer(),this.finished=!0}var i=new Uint8Array(so);for(var n=0;n<8;n++)i[n*4]=this.state[n]>>>24&255,i[n*4+1]=this.state[n]>>>16&255,i[n*4+2]=this.state[n]>>>8&255,i[n*4+3]=this.state[n]>>>0&255;return i},e.prototype.hashBuffer=function(){var r=this,t=r.buffer,s=r.state,n=s[0],i=s[1],c=s[2],o=s[3],a=s[4],f=s[5],h=s[6],l=s[7];for(var d=0;d<C;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 m=this.temp[d-2],g=(m>>>17|m<<15)^(m>>>19|m<<13)^m>>>10;m=this.temp[d-15];var w=(m>>>7|m<<25)^(m>>>18|m<<14)^m>>>3;this.temp[d]=(g+this.temp[d-7]|0)+(w+this.temp[d-16]|0)}var y=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&f^~a&h)|0)+(l+(no[d]+this.temp[d]|0)|0)|0,p=((n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10))+(n&i^n&c^i&c)|0;l=h,h=f,f=a,a=o+y|0,o=c,c=i,i=n,n=y+p|0}s[0]+=n,s[1]+=i,s[2]+=c,s[3]+=o,s[4]+=a,s[5]+=f,s[6]+=h,s[7]+=l},e}();function Pc(e){var r=z(e);if(r.byteLength>C){var t=new tr;t.update(r),r=t.digest()}var s=new Uint8Array(C);return s.set(r),s}var ao=function(){function e(r){this.secret=r,this.hash=new tr,this.reset()}return e.prototype.update=function(r){if(le(r)||this.error)return;try{this.hash.update(z(r))}catch(t){this.error=t}},e.prototype.digestSync=function(){if(this.error)throw this.error;if(this.outer){if(!this.outer.finished)this.outer.update(this.hash.digest());return this.outer.digest()}return this.hash.digest()},e.prototype.digest=function(){return tt(this,void 0,void 0,function(){return st(this,function(r){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new tr,this.secret){this.outer=new tr;var r=Pc(this.secret),t=new Uint8Array(C);t.set(r);for(var s=0;s<C;s++)r[s]^=54,t[s]^=92;this.hash.update(r),this.outer.update(t);for(var s=0;s<r.byteLength;s++)r[s]=0}},e}();function fo(e){if(Nc(e)&&typeof e.crypto.subtle==="object"){var r=e.crypto.subtle;return Oc(r)}return!1}function Nc(e){if(typeof e==="object"&&typeof e.crypto==="object"){var r=e.crypto.getRandomValues;return typeof r==="function"}return!1}function Oc(e){return e&&Ic.every(function(r){return typeof e[r]==="function"})}var Ic=["decrypt","digest","encrypt","exportKey","generateKey","importKey","sign","verify"];var nt=function(){function e(r){if(fo(De()))this.hash=new Is(r);else this.hash=new ao(r)}return e.prototype.update=function(r,t){this.hash.update(z(r))},e.prototype.digest=function(){return this.hash.digest()},e.prototype.reset=function(){this.hash.reset()},e}();var co=rn(Os(),1),it=({serviceId:e,clientVersion:r})=>async()=>{const t=typeof window!=="undefined"&&window?.navigator?.userAgent?co.default.parse(window.navigator.userAgent):void 0,s=[["aws-sdk-js",r],["ua","2.0"],[`os/${t?.os?.name||"other"}`,t?.os?.version],["lang/js"],["md/browser",`${t?.browser?.name??"unknown"}_${t?.browser?.version??"unknown"}`]];if(e)s.push([`api/${e}`,r]);return s};var ot=(e)=>()=>Promise.reject(e);var lo=typeof TextEncoder=="function"?new TextEncoder:null,at=(e)=>{if(typeof e==="string"){if(lo)return lo.encode(e).byteLength;let r=e.length;for(let t=r-1;t>=0;t--){const s=e.charCodeAt(t);if(s>127&&s<=2047)r++;else if(s>2047&&s<=65535)r+=2;if(s>=56320&&s<=57343)t--}return r}else if(typeof e.byteLength==="number")return e.byteLength;else if(typeof e.size==="number")return e.size;throw new Error(`Body Length computation failed for ${e}`)};var mo={["required"]:!1,type:"String"},ho={["required"]:!0,default:!1,type:"Boolean"},go={["ref"]:"Endpoint"},Ao={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},Ro={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},Y={},yo={["fn"]:"getAttr",["argv"]:[{["ref"]:"PartitionResult"},"supportsFIPS"]},wo={["fn"]:"booleanEquals",["argv"]:[!0,{["fn"]:"getAttr",["argv"]:[{["ref"]:"PartitionResult"},"supportsDualStack"]}]},po=[Ao],So=[Ro],Eo=[{["ref"]:"Region"}],kc={version:"1.0",parameters:{Region:mo,UseDualStack:ho,UseFIPS:ho,Endpoint:mo},rules:[{conditions:[{["fn"]:"isSet",["argv"]:[go]}],rules:[{conditions:po,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:"error"},{rules:[{conditions:So,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:"error"},{endpoint:{url:go,properties:Y,headers:Y},type:"endpoint"}],type:"tree"}],type:"tree"},{rules:[{conditions:[{["fn"]:"isSet",["argv"]:Eo}],rules:[{conditions:[{["fn"]:"aws.partition",["argv"]:Eo,assign:"PartitionResult"}],rules:[{conditions:[Ao,Ro],rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[!0,yo]},wo],rules:[{rules:[{endpoint:{url:"https://bedrock-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Y,headers:Y},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:"error"}],type:"tree"},{conditions:po,rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[yo,!0]}],rules:[{rules:[{endpoint:{url:"https://bedrock-fips.{Region}.{PartitionResult#dnsSuffix}",properties:Y,headers:Y},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"FIPS is enabled but this partition does not support FIPS",type:"error"}],type:"tree"},{conditions:So,rules:[{conditions:[wo],rules:[{rules:[{endpoint:{url:"https://bedrock.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:Y,headers:Y},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"DualStack is enabled but this partition does not support DualStack",type:"error"}],type:"tree"},{rules:[{endpoint:{url:"https://bedrock.{Region}.{PartitionResult#dnsSuffix}",properties:Y,headers:Y},type:"endpoint"}],type:"tree"}],type:"tree"}],type:"tree"},{error:"Invalid Configuration: Missing Region",type:"error"}],type:"tree"}]},uo=kc;var Mo=(e,r={})=>{return Be(uo,{endpointParams:e,logger:r.logger})};J.aws=Ge;var To=(e)=>{return{apiVersion:"2023-04-20",base64Decoder:e?.base64Decoder??fe,base64Encoder:e?.base64Encoder??Ee,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Mo,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Ji,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(r)=>r.getIdentityProvider("aws.auth#sigv4"),signer:new Ce}],logger:e?.logger??new ge,serviceId:e?.serviceId??"Bedrock",urlParser:e?.urlParser??ie,utf8Decoder:e?.utf8Decoder??$,utf8Encoder:e?.utf8Encoder??Se}};var Io=rn(Os(),1);var Po=["in-region","cross-region","mobile","standard","legacy"];var ft=({defaultsMode:e}={})=>ui(async()=>{const r=typeof e==="function"?await e():e;switch(r?.toLowerCase()){case"auto":return Promise.resolve(Fc()?"mobile":"standard");case"mobile":case"in-region":case"cross-region":case"standard":case"legacy":return Promise.resolve(r?.toLocaleLowerCase());case void 0:return Promise.resolve("legacy");default:throw new Error(`Invalid parameter for "defaultsMode", expect ${Po.join(", ")}, got ${r}`)}}),Fc=()=>{const r=(typeof window!=="undefined"&&window?.navigator?.userAgent?Io.default.parse(window.navigator.userAgent):void 0)?.platform?.type;return r==="tablet"||r==="mobile"};var No=(e)=>{const r=ft(e),t=()=>r().then(Br),s=To(e);return{...s,...e,runtime:"browser",defaultsMode:r,bodyLengthChecker:e?.bodyLengthChecker??at,credentialDefaultProvider:e?.credentialDefaultProvider??((n)=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??it({serviceId:s.serviceId,clientVersion:eo.version}),maxAttempts:e?.maxAttempts??V,region:e?.region??ot("Region is missing"),requestHandler:Fe.create(e?.requestHandler??t),retryMode:e?.retryMode??(async()=>(await t()).retryMode||He),sha256:e?.sha256??nt,streamCollector:e?.streamCollector??Ve,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(Rr)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(ur))}};var ct=(e)=>{let r=async()=>{if(e.region===void 0)throw new Error("Region is missing from runtimeConfig");const t=e.region;if(typeof t==="string")return t;return t()};return{setRegion(t){r=t},region(){return r}}},dt=(e)=>{return{region:e.region()}};var Oo=(e)=>{const r=e.httpAuthSchemes;let{httpAuthSchemeProvider:t,credentials:s}=e;return{setHttpAuthScheme(n){const i=r.findIndex((c)=>c.schemeId===n.schemeId);if(i===-1)r.push(n);else r.splice(i,1,n)},httpAuthSchemes(){return r},setHttpAuthSchemeProvider(n){t=n},httpAuthSchemeProvider(){return t},setCredentials(n){s=n},credentials(){return s}}},ko=(e)=>{return{httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}};var lt=(e)=>e,Fo=(e,r)=>{const t={...lt(ct(e)),...lt(Gr(e)),...lt(ir(e)),...lt(Oo(e))};return r.forEach((s)=>s.configure(t)),{...e,...dt(t),...zr(t),...or(t),...ko(t)}};class ks extends ve{constructor(...[e]){const r=No(e||{}),t=ji(r),s=lr(t),n=Dr(s),i=Tr(n),c=ar(i),o=Ir(c),a=Zi(o),f=Fo(a,e?.extensions||[]);super(f);this.config=f,this.middlewareStack.use(Er(this.config)),this.middlewareStack.use(Hr(this.config)),this.middlewareStack.use(qr(this.config)),this.middlewareStack.use(fr(this.config)),this.middlewareStack.use(cr(this.config)),this.middlewareStack.use(dr(this.config)),this.middlewareStack.use(Nr(this.config,{httpAuthSchemeParametersProvider:Qi,identityProviderConfigProvider:async(h)=>new Je({"aws.auth#sigv4":h.credentials})})),this.middlewareStack.use(Wr(this.config))}destroy(){super.destroy()}}class U extends xe{constructor(e){super(e);Object.setPrototypeOf(this,U.prototype)}}class mt extends U{constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,mt.prototype)}}class ht extends U{constructor(e){super({name:"ConflictException",$fault:"client",...e});this.name="ConflictException",this.$fault="client",Object.setPrototypeOf(this,ht.prototype)}}var xo;(function(e){e.visit=(r,t)=>{if(r.s3Uri!==void 0)return t.s3Uri(r.s3Uri);return t._(r.$unknown[0],r.$unknown[1])}})(xo||(xo={}));var Co;(function(e){e.visit=(r,t)=>{if(r.automated!==void 0)return t.automated(r.automated);if(r.human!==void 0)return t.human(r.human);return t._(r.$unknown[0],r.$unknown[1])}})(Co||(Co={}));var $o;(function(e){e.visit=(r,t)=>{if(r.bedrockModel!==void 0)return t.bedrockModel(r.bedrockModel);return t._(r.$unknown[0],r.$unknown[1])}})($o||($o={}));var Do;(function(e){e.visit=(r,t)=>{if(r.models!==void 0)return t.models(r.models);return t._(r.$unknown[0],r.$unknown[1])}})(Do||(Do={}));class gt extends U{constructor(e){super({name:"InternalServerException",$fault:"server",...e});this.name="InternalServerException",this.$fault="server",Object.setPrototypeOf(this,gt.prototype)}}class yt extends U{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,yt.prototype)}}class wt extends U{constructor(e){super({name:"ServiceQuotaExceededException",$fault:"client",...e});this.name="ServiceQuotaExceededException",this.$fault="client",Object.setPrototypeOf(this,wt.prototype)}}class pt extends U{constructor(e){super({name:"ThrottlingException",$fault:"client",...e});this.name="ThrottlingException",this.$fault="client",Object.setPrototypeOf(this,pt.prototype)}}class St extends U{constructor(e){super({name:"ValidationException",$fault:"client",...e});this.name="ValidationException",this.$fault="client",Object.setPrototypeOf(this,St.prototype)}}class Et extends U{constructor(e){super({name:"TooManyTagsException",$fault:"client",...e});this.name="TooManyTagsException",this.$fault="client",Object.setPrototypeOf(this,Et.prototype),this.resourceName=e.resourceName}}var Bo=async(e,r)=>{const t=Ae(e,r),s={"content-type":"application/json"};t.bp("/model-customization-jobs");let n;return n=JSON.stringify(R(e,{baseModelIdentifier:[],clientRequestToken:[!0,(i)=>i??qe()],customModelKmsKeyId:[],customModelName:[],customModelTags:(i)=>k(i),customizationType:[],hyperParameters:(i)=>k(i),jobName:[],jobTags:(i)=>k(i),outputDataConfig:(i)=>k(i),roleArn:[],trainingDataConfig:(i)=>k(i),validationDataConfig:(i)=>k(i),vpcConfig:(i)=>k(i)})),t.m("POST").h(s).b(n),t.build()};var Go=async(e,r)=>{const t=Ae(e,r),s={};t.bp("/model-customization-jobs/{jobIdentifier}"),t.p("jobIdentifier",()=>e.jobIdentifier,"{jobIdentifier}",!1);let n;return t.m("GET").h(s).b(n),t.build()};var zo=async(e,r)=>{const t=Ae(e,r),s={};t.bp("/foundation-models");const n=A({[_o]:[,e[_o]],[Uo]:[,e[Uo]],[Lo]:[,e[Lo]],[bo]:[,e[bo]]});let i;return t.m("GET").h(s).q(n).b(i),t.build()};var Ho=async(e,r)=>{if(e.statusCode!==201&&e.statusCode>=300)return Fs(e,r);const t=A({$metadata:H(e)}),s=de(Xe(await D(e.body,r)),"body"),n=R(s,{jobArn:S});return Object.assign(t,n),t};var Wo=async(e,r)=>{if(e.statusCode!==200&&e.statusCode>=300)return Fs(e,r);const t=A({$metadata:H(e)}),s=de(Xe(await D(e.body,r)),"body"),n=R(s,{baseModelArn:S,clientRequestToken:S,creationTime:(i)=>de(Lr(i)),customizationType:S,endTime:(i)=>de(Lr(i)),failureMessage:S,hyperParameters:k,jobArn:S,jobName:S,lastModifiedTime:(i)=>de(Lr(i)),outputDataConfig:k,outputModelArn:S,outputModelKmsKeyArn:S,outputModelName:S,roleArn:S,status:S,trainingDataConfig:k,trainingMetrics:(i)=>qc(i,r),validationDataConfig:k,validationMetrics:(i)=>vc(i,r),vpcConfig:k});return Object.assign(t,n),t};var qo=async(e,r)=>{if(e.statusCode!==200&&e.statusCode>=300)return Fs(e,r);const t=A({$metadata:H(e)}),s=de(Xe(await D(e.body,r)),"body"),n=R(s,{modelSummaries:k});return Object.assign(t,n),t};var Fs=async(e,r)=>{const t={...e,body:await et(e.body,r)},s=rt(e,t.body);switch(s){case"AccessDeniedException":case"com.amazonaws.bedrock#AccessDeniedException":throw await bc(t,r);case"ConflictException":case"com.amazonaws.bedrock#ConflictException":throw await Lc(t,r);case"InternalServerException":case"com.amazonaws.bedrock#InternalServerException":throw await _c(t,r);case"ResourceNotFoundException":case"com.amazonaws.bedrock#ResourceNotFoundException":throw await Bc(t,r);case"ServiceQuotaExceededException":case"com.amazonaws.bedrock#ServiceQuotaExceededException":throw await Gc(t,r);case"ThrottlingException":case"com.amazonaws.bedrock#ThrottlingException":throw await zc(t,r);case"ValidationException":case"com.amazonaws.bedrock#ValidationException":throw await Wc(t,r);case"TooManyTagsException":case"com.amazonaws.bedrock#TooManyTagsException":throw await Hc(t,r);default:const n=t.body;return Uc({output:e,parsedBody:n,errorCode:s})}},Uc=_r(U),bc=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new mt({$metadata:H(e),...t});return T(i,e.body)},Lc=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new ht({$metadata:H(e),...t});return T(i,e.body)},_c=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new gt({$metadata:H(e),...t});return T(i,e.body)},Bc=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new yt({$metadata:H(e),...t});return T(i,e.body)},Gc=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new wt({$metadata:H(e),...t});return T(i,e.body)},zc=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new pt({$metadata:H(e),...t});return T(i,e.body)},Hc=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S,resourceName:S});Object.assign(t,n);const i=new Et({$metadata:H(e),...t});return T(i,e.body)},Wc=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new St({$metadata:H(e),...t});return T(i,e.body)};var qc=(e,r)=>{return R(e,{trainingLoss:as})},vc=(e,r)=>{return(e||[]).filter((s)=>s!=null).map((s)=>{return Vc(s,r)})},Vc=(e,r)=>{return R(e,{validationLoss:as})},H=(e)=>({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"]});var Uo="byCustomizationType",bo="byInferenceType";var Lo="byOutputModality",_o="byProvider";class xs extends G.classBuilder().ep({...$e}).m(function(e,r,t,s){return[q(t,this.serialize,this.deserialize),v(t,e.getEndpointParameterInstructions())]}).s("AmazonBedrockControlPlaneService","CreateModelCustomizationJob",{}).n("BedrockClient","CreateModelCustomizationJobCommand").f(void 0,void 0).ser(Bo).de(Ho).build(){}class Cs extends G.classBuilder().ep({...$e}).m(function(e,r,t,s){return[q(t,this.serialize,this.deserialize),v(t,e.getEndpointParameterInstructions())]}).s("AmazonBedrockControlPlaneService","GetModelCustomizationJob",{}).n("BedrockClient","GetModelCustomizationJobCommand").f(void 0,void 0).ser(Go).de(Wo).build(){}class $s extends G.classBuilder().ep({...$e}).m(function(e,r,t,s){return[q(t,this.serialize,this.deserialize),v(t,e.getEndpointParameterInstructions())]}).s("AmazonBedrockControlPlaneService","ListFoundationModels",{}).n("BedrockClient","ListFoundationModelsCommand").f(void 0,void 0).ser(zo).de(qo).build(){}async function kP(e){re.debug(e);const r=new xs(e),t=await Ds.send(r);return re.debug("Successfully create model customization job"),re.debug(t),t}async function FP(e){re.debug(e);const r=new Cs(e),t=await Ds.send(r);return re.debug("Successfully get model customization job"),re.debug(t),t}async function xP(e){re.debug(e);const r=new $s(e),t=await Ds.send(r);return re.debug("Successfully list foundation models"),re.debug(t),t}var Ds=new ks({region:process.env.REGION||"us-east-1"}),re=console;var vo=(e)=>({...e,eventStreamMarshaller:e.eventStreamSerdeProvider(e)});function Yc(e){return{schemeId:"aws.auth#sigv4",signingProperties:{name:"bedrock",region:e.region},propertiesExtractor:(r,t)=>({signingProperties:{config:r,context:t}})}}var Vo=async(e,r,t)=>{return{operation:W(r).operation,region:await F(e.region)()||(()=>{throw new Error("expected `region` to be configured for `aws.auth#sigv4`")})()}},Yo=(e)=>{const r=[];switch(e.operation){default:r.push(Yc(e))}return r},Ko=(e)=>{return{...jr(e)}};var Xo=(e)=>{return{...e,useDualstackEndpoint:e.useDualstackEndpoint??!1,useFipsEndpoint:e.useFipsEndpoint??!1,defaultSigningName:"bedrock"}},At={UseFIPS:{type:"builtInParams",name:"useFipsEndpoint"},Endpoint:{type:"builtInParams",name:"endpoint"},Region:{type:"builtInParams",name:"region"},UseDualStack:{type:"builtInParams",name:"useDualstackEndpoint"}};var Qo={name:"@aws-sdk/client-bedrock-runtime",description:"AWS SDK for JavaScript Bedrock Runtime Client for Node.js, Browser and React Native",version:"3.632.0",scripts:{build:"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-bedrock-runtime","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4",clean:"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo bedrock-runtime"},main:"./dist-cjs/index.js",types:"./dist-types/index.d.ts",module:"./dist-es/index.js",sideEffects:!1,dependencies:{"@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/client-sso-oidc":"3.632.0","@aws-sdk/client-sts":"3.632.0","@aws-sdk/core":"3.629.0","@aws-sdk/credential-provider-node":"3.632.0","@aws-sdk/middleware-host-header":"3.620.0","@aws-sdk/middleware-logger":"3.609.0","@aws-sdk/middleware-recursion-detection":"3.620.0","@aws-sdk/middleware-user-agent":"3.632.0","@aws-sdk/region-config-resolver":"3.614.0","@aws-sdk/types":"3.609.0","@aws-sdk/util-endpoints":"3.632.0","@aws-sdk/util-user-agent-browser":"3.609.0","@aws-sdk/util-user-agent-node":"3.614.0","@smithy/config-resolver":"^3.0.5","@smithy/core":"^2.3.2","@smithy/eventstream-serde-browser":"^3.0.6","@smithy/eventstream-serde-config-resolver":"^3.0.3","@smithy/eventstream-serde-node":"^3.0.5","@smithy/fetch-http-handler":"^3.2.4","@smithy/hash-node":"^3.0.3","@smithy/invalid-dependency":"^3.0.3","@smithy/middleware-content-length":"^3.0.5","@smithy/middleware-endpoint":"^3.1.0","@smithy/middleware-retry":"^3.0.14","@smithy/middleware-serde":"^3.0.3","@smithy/middleware-stack":"^3.0.3","@smithy/node-config-provider":"^3.1.4","@smithy/node-http-handler":"^3.1.4","@smithy/protocol-http":"^4.1.0","@smithy/smithy-client":"^3.1.12","@smithy/types":"^3.3.0","@smithy/url-parser":"^3.0.3","@smithy/util-base64":"^3.0.0","@smithy/util-body-length-browser":"^3.0.0","@smithy/util-body-length-node":"^3.0.0","@smithy/util-defaults-mode-browser":"^3.0.14","@smithy/util-defaults-mode-node":"^3.0.14","@smithy/util-endpoints":"^2.0.5","@smithy/util-middleware":"^3.0.3","@smithy/util-retry":"^3.0.3","@smithy/util-stream":"^3.1.3","@smithy/util-utf8":"^3.0.0",tslib:"^2.6.2"},devDependencies:{"@tsconfig/node16":"16.1.3","@types/node":"^16.18.96",concurrently:"7.0.0","downlevel-dts":"0.10.1",rimraf:"3.0.2",typescript:"~4.9.5"},engines:{node:">=16.0.0"},typesVersions:{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},files:["dist-*/**"],author:{name:"AWS SDK for JavaScript Team",url:"https://aws.amazon.com/javascript/"},license:"Apache-2.0",browser:{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},homepage:"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-bedrock-runtime",repository:{type:"git",url:"https://github.com/aws/aws-sdk-js-v3.git",directory:"clients/client-bedrock-runtime"}};var Xc=function(){function e(){this.crc32=new Re}return e.prototype.update=function(r){if(le(r))return;this.crc32.update(z(r))},e.prototype.digest=function(){return tt(this,void 0,void 0,function(){return st(this,function(r){return[2,us(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new Re},e}();var Re=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(r){var t,s;try{for(var n=to(r),i=n.next();!i.done;i=n.next()){var c=i.value;this.checksum=this.checksum>>>8^Jc[(this.checksum^c)&255]}}catch(o){t={error:o}}finally{try{if(i&&!i.done&&(s=n.return))s.call(n)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}();var Qc=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],Jc=Ms(Qc);function Jo(e){for(let r=0;r<8;r++)e[r]^=255;for(let r=7;r>-1;r--)if(e[r]++,e[r]!==0)break}class Ue{constructor(e){if(this.bytes=e,e.byteLength!==8)throw new Error("Int64 buffers must be exactly 8 bytes")}static fromNumber(e){if(e>9223372036854776000||e<-9223372036854776000)throw new Error(`${e} is too large (or, if negative, too small) to represent as an Int64`);const r=new Uint8Array(8);for(let t=7,s=Math.abs(Math.round(e));t>-1&&s>0;t--,s/=256)r[t]=s;if(e<0)Jo(r);return new Ue(r)}valueOf(){const e=this.bytes.slice(0),r=e[0]&128;if(r)Jo(e);return parseInt(N(e),16)*(r?-1:1)}toString(){return String(this.valueOf())}}class Us{constructor(e,r){this.toUtf8=e,this.fromUtf8=r}format(e){const r=[];for(let n of Object.keys(e)){const i=this.fromUtf8(n);r.push(Uint8Array.from([i.byteLength]),i,this.formatHeaderValue(e[n]))}const t=new Uint8Array(r.reduce((n,i)=>n+i.byteLength,0));let s=0;for(let n of r)t.set(n,s),s+=n.byteLength;return t}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 r=new DataView(new ArrayBuffer(3));return r.setUint8(0,3),r.setInt16(1,e.value,!1),new Uint8Array(r.buffer);case"integer":const t=new DataView(new ArrayBuffer(5));return t.setUint8(0,4),t.setInt32(1,e.value,!1),new Uint8Array(t.buffer);case"long":const s=new Uint8Array(9);return s[0]=5,s.set(e.value.bytes,1),s;case"binary":const n=new DataView(new ArrayBuffer(3+e.value.byteLength));n.setUint8(0,6),n.setUint16(1,e.value.byteLength,!1);const i=new Uint8Array(n.buffer);return i.set(e.value,3),i;case"string":const c=this.fromUtf8(e.value),o=new DataView(new ArrayBuffer(3+c.byteLength));o.setUint8(0,7),o.setUint16(1,c.byteLength,!1);const a=new Uint8Array(o.buffer);return a.set(c,3),a;case"timestamp":const f=new Uint8Array(9);return f[0]=8,f.set(Ue.fromNumber(e.value.valueOf()).bytes,1),f;case"uuid":if(!od.test(e.value))throw new Error(`Invalid UUID received: ${e.value}`);const h=new Uint8Array(17);return h[0]=9,h.set(Ur(e.value.replace(/\-/g,"")),1),h}}parse(e){const r={};let t=0;while(t<e.byteLength){const s=e.getUint8(t++),n=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+t,s));switch(t+=s,e.getUint8(t++)){case 0:r[n]={type:jo,value:!0};break;case 1:r[n]={type:jo,value:!1};break;case 2:r[n]={type:Zc,value:e.getInt8(t++)};break;case 3:r[n]={type:jc,value:e.getInt16(t,!1)},t+=2;break;case 4:r[n]={type:ed,value:e.getInt32(t,!1)},t+=4;break;case 5:r[n]={type:rd,value:new Ue(new Uint8Array(e.buffer,e.byteOffset+t,8))},t+=8;break;case 6:const i=e.getUint16(t,!1);t+=2,r[n]={type:td,value:new Uint8Array(e.buffer,e.byteOffset+t,i)},t+=i;break;case 7:const c=e.getUint16(t,!1);t+=2,r[n]={type:sd,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+t,c))},t+=c;break;case 8:r[n]={type:nd,value:new Date(new Ue(new Uint8Array(e.buffer,e.byteOffset+t,8)).valueOf())},t+=8;break;case 9:const o=new Uint8Array(e.buffer,e.byteOffset+t,16);t+=16,r[n]={type:id,value:`${N(o.subarray(0,4))}-${N(o.subarray(4,6))}-${N(o.subarray(6,8))}-${N(o.subarray(8,10))}-${N(o.subarray(10))}`};break;default:throw new Error("Unrecognized header type tag")}}return r}}var Zo;(function(e){e[e.boolTrue=0]="boolTrue",e[e.boolFalse=1]="boolFalse",e[e.byte=2]="byte",e[e.short=3]="short",e[e.integer=4]="integer",e[e.long=5]="long",e[e.byteArray=6]="byteArray",e[e.string=7]="string",e[e.timestamp=8]="timestamp",e[e.uuid=9]="uuid"})(Zo||(Zo={}));var jo="boolean",Zc="byte",jc="short",ed="integer",rd="long",td="binary",sd="string",nd="timestamp",id="uuid",od=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;function ra({byteLength:e,byteOffset:r,buffer:t}){if(e<ad)throw new Error("Provided message too short to accommodate event stream message overhead");const s=new DataView(t,r,e),n=s.getUint32(0,!1);if(e!==n)throw new Error("Reported message length does not match received message length");const i=s.getUint32(ea,!1),c=s.getUint32(me,!1),o=s.getUint32(e-ue,!1),a=new Re().update(new Uint8Array(t,r,me));if(c!==a.digest())throw new Error(`The prelude checksum specified in the message (${c}) does not match the calculated CRC32 checksum (${a.digest()})`);if(a.update(new Uint8Array(t,r+me,e-(me+ue))),o!==a.digest())throw new Error(`The message checksum (${a.digest()}) did not match the expected value of ${o}`);return{headers:new DataView(t,r+me+ue,i),body:new Uint8Array(t,r+me+ue+i,n-i-(me+ue+ue))}}var ea=4,me=ea*2,ue=4,ad=me+ue*2;class bs{constructor(e,r){this.headerMarshaller=new Us(e,r),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){const e=this.messageBuffer.pop(),r=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return r}}}getAvailableMessages(){const e=this.messageBuffer;this.messageBuffer=[];const r=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return r}}}encode({headers:e,body:r}){const t=this.headerMarshaller.format(e),s=t.byteLength+r.byteLength+16,n=new Uint8Array(s),i=new DataView(n.buffer,n.byteOffset,n.byteLength),c=new Re;return i.setUint32(0,s,!1),i.setUint32(4,t.byteLength,!1),i.setUint32(8,c.update(n.subarray(0,8)).digest(),!1),n.set(t,12),n.set(r,t.byteLength+12),i.setUint32(s-4,c.update(n.subarray(8,s-4)).digest(),!1),n}decode(e){const{headers:r,body:t}=ra(e);return{headers:this.headerMarshaller.parse(r),body:t}}formatHeaders(e){return this.headerMarshaller.format(e)}}class Ls{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}class _s{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);if(this.options.includeEndFrame)yield new Uint8Array(0)}}class Bs{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){const r=await this.options.deserializer(e);if(r===void 0)continue;yield r}}}class Gs{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}function ta(e){let r=0,t=0,s=null,n=null;const i=(o)=>{if(typeof o!=="number")throw new Error("Attempted to allocate an event message where size was not a number: "+o);r=o,t=4,s=new Uint8Array(o),new DataView(s.buffer).setUint32(0,o,!1)},c=async function*(){const o=e[Symbol.asyncIterator]();while(!0){const{value:a,done:f}=await o.next();if(f){if(!r)return;else if(r===t)yield s;else throw new Error("Truncated event message received.");return}const h=a.length;let l=0;while(l<h){if(!s){const m=h-l;if(!n)n=new Uint8Array(4);const g=Math.min(4-t,m);if(n.set(a.slice(l,l+g),t),t+=g,l+=g,t<4)break;i(new DataView(n.buffer).getUint32(0,!1)),n=null}const d=Math.min(r-t,h-l);if(s.set(a.slice(l,l+d),t),t+=d,l+=d,r&&r===t)yield s,s=null,r=0,t=0}}};return{[Symbol.asyncIterator]:c}}function sa(e,r){return async function(t){const{value:s}=t.headers[":message-type"];if(s==="error"){const n=new Error(t.headers[":error-message"].value||"UnknownError");throw n.name=t.headers[":error-code"].value,n}else if(s==="exception"){const n=t.headers[":exception-type"].value,i={[n]:t},c=await e(i);if(c.$unknown){const o=new Error(r(t.body));throw o.name=n,o}throw c[n]}else if(s==="event"){const n={[t.headers[":event-type"].value]:t},i=await e(n);if(i.$unknown)return;return i}else throw Error(`Unrecognizable event type: ${t.headers[":event-type"].value}`)}}class Rt{constructor({utf8Encoder:e,utf8Decoder:r}){this.eventStreamCodec=new bs(e,r),this.utfEncoder=e}deserialize(e,r){const t=ta(e);return new Bs({messageStream:new Ls({inputStream:t,decoder:this.eventStreamCodec}),deserializer:sa(r,this.utfEncoder)})}serialize(e,r){return new _s({messageStream:new Gs({inputStream:e,serializer:r}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}var na=(e)=>({[Symbol.asyncIterator]:async function*(){const r=e.getReader();try{while(!0){const{done:t,value:s}=await r.read();if(t)return;yield s}}finally{r.releaseLock()}}}),ia=(e)=>{const r=e[Symbol.asyncIterator]();return new ReadableStream({async pull(t){const{done:s,value:n}=await r.next();if(s)return t.close();t.enqueue(n)}})};class zs{constructor({utf8Encoder:e,utf8Decoder:r}){this.universalMarshaller=new Rt({utf8Decoder:r,utf8Encoder:e})}deserialize(e,r){const t=fd(e)?na(e):e;return this.universalMarshaller.deserialize(t,r)}serialize(e,r){const t=this.universalMarshaller.serialize(e,r);return typeof ReadableStream==="function"?ia(t):t}}var fd=(e)=>typeof ReadableStream==="function"&&e instanceof ReadableStream;var oa=(e)=>new zs(e);var aa={["required"]:!1,type:"String"},fa={["required"]:!0,default:!1,type:"Boolean"},ca={["ref"]:"Endpoint"},ya={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseFIPS"},!0]},wa={["fn"]:"booleanEquals",["argv"]:[{["ref"]:"UseDualStack"},!0]},K={},da={["fn"]:"getAttr",["argv"]:[{["ref"]:"PartitionResult"},"supportsFIPS"]},la={["fn"]:"booleanEquals",["argv"]:[!0,{["fn"]:"getAttr",["argv"]:[{["ref"]:"PartitionResult"},"supportsDualStack"]}]},ma=[ya],ha=[wa],ga=[{["ref"]:"Region"}],cd={version:"1.0",parameters:{Region:aa,UseDualStack:fa,UseFIPS:fa,Endpoint:aa},rules:[{conditions:[{["fn"]:"isSet",["argv"]:[ca]}],rules:[{conditions:ma,error:"Invalid Configuration: FIPS and custom endpoint are not supported",type:"error"},{rules:[{conditions:ha,error:"Invalid Configuration: Dualstack and custom endpoint are not supported",type:"error"},{endpoint:{url:ca,properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"},{rules:[{conditions:[{["fn"]:"isSet",["argv"]:ga}],rules:[{conditions:[{["fn"]:"aws.partition",["argv"]:ga,assign:"PartitionResult"}],rules:[{conditions:[ya,wa],rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[!0,da]},la],rules:[{rules:[{endpoint:{url:"https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"FIPS and DualStack are enabled, but this partition does not support one or both",type:"error"}],type:"tree"},{conditions:ma,rules:[{conditions:[{["fn"]:"booleanEquals",["argv"]:[da,!0]}],rules:[{rules:[{endpoint:{url:"https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}",properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"FIPS is enabled but this partition does not support FIPS",type:"error"}],type:"tree"},{conditions:ha,rules:[{conditions:[la],rules:[{rules:[{endpoint:{url:"https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}",properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"},{error:"DualStack is enabled but this partition does not support DualStack",type:"error"}],type:"tree"},{rules:[{endpoint:{url:"https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}",properties:K,headers:K},type:"endpoint"}],type:"tree"}],type:"tree"}],type:"tree"},{error:"Invalid Configuration: Missing Region",type:"error"}],type:"tree"}]},pa=cd;var Sa=(e,r={})=>{return Be(pa,{endpointParams:e,logger:r.logger})};J.aws=Ge;var Ea=(e)=>{return{apiVersion:"2023-09-30",base64Decoder:e?.base64Decoder??fe,base64Encoder:e?.base64Encoder??Ee,disableHostPrefix:e?.disableHostPrefix??!1,endpointProvider:e?.endpointProvider??Sa,extensions:e?.extensions??[],httpAuthSchemeProvider:e?.httpAuthSchemeProvider??Yo,httpAuthSchemes:e?.httpAuthSchemes??[{schemeId:"aws.auth#sigv4",identityProvider:(r)=>r.getIdentityProvider("aws.auth#sigv4"),signer:new Ce}],logger:e?.logger??new ge,serviceId:e?.serviceId??"Bedrock Runtime",urlParser:e?.urlParser??ie,utf8Decoder:e?.utf8Decoder??$,utf8Encoder:e?.utf8Encoder??Se}};var Aa=(e)=>{const r=ft(e),t=()=>r().then(Br),s=Ea(e);return{...s,...e,runtime:"browser",defaultsMode:r,bodyLengthChecker:e?.bodyLengthChecker??at,credentialDefaultProvider:e?.credentialDefaultProvider??((n)=>()=>Promise.reject(new Error("Credential is missing"))),defaultUserAgentProvider:e?.defaultUserAgentProvider??it({serviceId:s.serviceId,clientVersion:Qo.version}),eventStreamSerdeProvider:e?.eventStreamSerdeProvider??oa,maxAttempts:e?.maxAttempts??V,region:e?.region??ot("Region is missing"),requestHandler:Fe.create(e?.requestHandler??t),retryMode:e?.retryMode??(async()=>(await t()).retryMode||He),sha256:e?.sha256??nt,streamCollector:e?.streamCollector??Ve,useDualstackEndpoint:e?.useDualstackEndpoint??(()=>Promise.resolve(Rr)),useFipsEndpoint:e?.useFipsEndpoint??(()=>Promise.resolve(ur))}};var Ra=(e)=>{const r=e.httpAuthSchemes;let{httpAuthSchemeProvider:t,credentials:s}=e;return{setHttpAuthScheme(n){const i=r.findIndex((c)=>c.schemeId===n.schemeId);if(i===-1)r.push(n);else r.splice(i,1,n)},httpAuthSchemes(){return r},setHttpAuthSchemeProvider(n){t=n},httpAuthSchemeProvider(){return t},setCredentials(n){s=n},credentials(){return s}}},ua=(e)=>{return{httpAuthSchemes:e.httpAuthSchemes(),httpAuthSchemeProvider:e.httpAuthSchemeProvider(),credentials:e.credentials()}};var ut=(e)=>e,Ma=(e,r)=>{const t={...ut(ct(e)),...ut(Gr(e)),...ut(ir(e)),...ut(Ra(e))};return r.forEach((s)=>s.configure(t)),{...e,...dt(t),...zr(t),...or(t),...ua(t)}};class Hs extends ve{constructor(...[e]){const r=Aa(e||{}),t=Xo(r),s=lr(t),n=Dr(s),i=Tr(n),c=ar(i),o=Ir(c),a=vo(o),f=Ko(a),h=Ma(f,e?.extensions||[]);super(h);this.config=h,this.middlewareStack.use(Er(this.config)),this.middlewareStack.use(Hr(this.config)),this.middlewareStack.use(qr(this.config)),this.middlewareStack.use(fr(this.config)),this.middlewareStack.use(cr(this.config)),this.middlewareStack.use(dr(this.config)),this.middlewareStack.use(Nr(this.config,{httpAuthSchemeParametersProvider:Vo,identityProviderConfigProvider:async(l)=>new Je({"aws.auth#sigv4":l.credentials})})),this.middlewareStack.use(Wr(this.config))}destroy(){super.destroy()}}class x extends xe{constructor(e){super(e);Object.setPrototypeOf(this,x.prototype)}}class Mt extends x{constructor(e){super({name:"AccessDeniedException",$fault:"client",...e});this.name="AccessDeniedException",this.$fault="client",Object.setPrototypeOf(this,Mt.prototype)}}var Ta;(function(e){e.visit=(r,t)=>{if(r.text!==void 0)return t.text(r.text);return t._(r.$unknown[0],r.$unknown[1])}})(Ta||(Ta={}));class Tt extends x{constructor(e){super({name:"InternalServerException",$fault:"server",...e});this.name="InternalServerException",this.$fault="server",Object.setPrototypeOf(this,Tt.prototype)}}class Pt extends x{constructor(e){super({name:"ResourceNotFoundException",$fault:"client",...e});this.name="ResourceNotFoundException",this.$fault="client",Object.setPrototypeOf(this,Pt.prototype)}}class It extends x{constructor(e){super({name:"ServiceQuotaExceededException",$fault:"client",...e});this.name="ServiceQuotaExceededException",this.$fault="client",Object.setPrototypeOf(this,It.prototype)}}class Nt extends x{constructor(e){super({name:"ThrottlingException",$fault:"client",...e});this.name="ThrottlingException",this.$fault="client",Object.setPrototypeOf(this,Nt.prototype)}}class Ot extends x{constructor(e){super({name:"ValidationException",$fault:"client",...e});this.name="ValidationException",this.$fault="client",Object.setPrototypeOf(this,Ot.prototype)}}var Ws;(function(e){e.visit=(r,t)=>{if(r.bytes!==void 0)return t.bytes(r.bytes);return t._(r.$unknown[0],r.$unknown[1])}})(Ws||(Ws={}));var Pa;(function(e){e.visit=(r,t)=>{if(r.text!==void 0)return t.text(r.text);return t._(r.$unknown[0],r.$unknown[1])}})(Pa||(Pa={}));var qs;(function(e){e.visit=(r,t)=>{if(r.bytes!==void 0)return t.bytes(r.bytes);return t._(r.$unknown[0],r.$unknown[1])}})(qs||(qs={}));var vs;(function(e){e.visit=(r,t)=>{if(r.json!==void 0)return t.json(r.json);if(r.text!==void 0)return t.text(r.text);if(r.image!==void 0)return t.image(r.image);if(r.document!==void 0)return t.document(r.document);return t._(r.$unknown[0],r.$unknown[1])}})(vs||(vs={}));var Vs;(function(e){e.visit=(r,t)=>{if(r.text!==void 0)return t.text(r.text);if(r.image!==void 0)return t.image(r.image);if(r.document!==void 0)return t.document(r.document);if(r.toolUse!==void 0)return t.toolUse(r.toolUse);if(r.toolResult!==void 0)return t.toolResult(r.toolResult);if(r.guardContent!==void 0)return t.guardContent(r.guardContent);return t._(r.$unknown[0],r.$unknown[1])}})(Vs||(Vs={}));var Ia;(function(e){e.visit=(r,t)=>{if(r.text!==void 0)return t.text(r.text);if(r.guardContent!==void 0)return t.guardContent(r.guardContent);return t._(r.$unknown[0],r.$unknown[1])}})(Ia||(Ia={}));var Na;(function(e){e.visit=(r,t)=>{if(r.auto!==void 0)return t.auto(r.auto);if(r.any!==void 0)return t.any(r.any);if(r.tool!==void 0)return t.tool(r.tool);return t._(r.$unknown[0],r.$unknown[1])}})(Na||(Na={}));var Ys;(function(e){e.visit=(r,t)=>{if(r.json!==void 0)return t.json(r.json);return t._(r.$unknown[0],r.$unknown[1])}})(Ys||(Ys={}));var Ks;(function(e){e.visit=(r,t)=>{if(r.toolSpec!==void 0)return t.toolSpec(r.toolSpec);return t._(r.$unknown[0],r.$unknown[1])}})(Ks||(Ks={}));var Oa;(function(e){e.visit=(r,t)=>{if(r.message!==void 0)return t.message(r.message);return t._(r.$unknown[0],r.$unknown[1])}})(Oa||(Oa={}));class kt extends x{constructor(e){super({name:"ModelErrorException",$fault:"client",...e});this.name="ModelErrorException",this.$fault="client",Object.setPrototypeOf(this,kt.prototype),this.originalStatusCode=e.originalStatusCode,this.resourceName=e.resourceName}}class Ft extends x{constructor(e){super({name:"ModelNotReadyException",$fault:"client",...e});this.name="ModelNotReadyException",this.$fault="client",Object.setPrototypeOf(this,Ft.prototype)}}class xt extends x{constructor(e){super({name:"ModelTimeoutException",$fault:"client",...e});this.name="ModelTimeoutException",this.$fault="client",Object.setPrototypeOf(this,xt.prototype)}}class Ct extends x{constructor(e){super({name:"ServiceUnavailableException",$fault:"server",...e});this.name="ServiceUnavailableException",this.$fault="server",Object.setPrototypeOf(this,Ct.prototype)}}var ka;(function(e){e.visit=(r,t)=>{if(r.text!==void 0)return t.text(r.text);if(r.toolUse!==void 0)return t.toolUse(r.toolUse);return t._(r.$unknown[0],r.$unknown[1])}})(ka||(ka={}));var Fa;(function(e){e.visit=(r,t)=>{if(r.toolUse!==void 0)return t.toolUse(r.toolUse);return t._(r.$unknown[0],r.$unknown[1])}})(Fa||(Fa={}));class $t extends x{constructor(e){super({name:"ModelStreamErrorException",$fault:"client",...e});this.name="ModelStreamErrorException",this.$fault="client",Object.setPrototypeOf(this,$t.prototype),this.originalStatusCode=e.originalStatusCode,this.originalMessage=e.originalMessage}}var xa;(function(e){e.visit=(r,t)=>{if(r.messageStart!==void 0)return t.messageStart(r.messageStart);if(r.contentBlockStart!==void 0)return t.contentBlockStart(r.contentBlockStart);if(r.contentBlockDelta!==void 0)return t.contentBlockDelta(r.contentBlockDelta);if(r.contentBlockStop!==void 0)return t.contentBlockStop(r.contentBlockStop);if(r.messageStop!==void 0)return t.messageStop(r.messageStop);if(r.metadata!==void 0)return t.metadata(r.metadata);if(r.internalServerException!==void 0)return t.internalServerException(r.internalServerException);if(r.modelStreamErrorException!==void 0)return t.modelStreamErrorException(r.modelStreamErrorException);if(r.validationException!==void 0)return t.validationException(r.validationException);if(r.throttlingException!==void 0)return t.throttlingException(r.throttlingException);if(r.serviceUnavailableException!==void 0)return t.serviceUnavailableException(r.serviceUnavailableException);return t._(r.$unknown[0],r.$unknown[1])}})(xa||(xa={}));var Ca;(function(e){e.visit=(r,t)=>{if(r.chunk!==void 0)return t.chunk(r.chunk);if(r.internalServerException!==void 0)return t.internalServerException(r.internalServerException);if(r.modelStreamErrorException!==void 0)return t.modelStreamErrorException(r.modelStreamErrorException);if(r.validationException!==void 0)return t.validationException(r.validationException);if(r.throttlingException!==void 0)return t.throttlingException(r.throttlingException);if(r.modelTimeoutException!==void 0)return t.modelTimeoutException(r.modelTimeoutException);if(r.serviceUnavailableException!==void 0)return t.serviceUnavailableException(r.serviceUnavailableException);return t._(r.$unknown[0],r.$unknown[1])}})(Ca||(Ca={}));var $a=(e)=>({...e,...e.body&&{body:Ke}}),Da=(e)=>({...e,...e.body&&{body:Ke}}),Ua=(e)=>({...e,...e.body&&{body:Ke}});var ba=(e)=>({...e,...e.body&&{body:"STREAMING_CONTENT"}});var La=async(e,r)=>{const t=Ae(e,r),s=A({},Ka,{[Qs]:e[Dt]||"application/octet-stream",[Xs]:e[Xs],[ef]:e[Ja],[Za]:e[Xa],[ja]:e[Qa]});t.bp("/model/{modelId}/invoke"),t.p("modelId",()=>e.modelId,"{modelId}",!1);let n;if(e.body!==void 0)n=e.body;return t.m("POST").h(s).b(n),t.build()},_a=async(e,r)=>{const t=Ae(e,r),s=A({},Ka,{[Qs]:e[Dt]||"application/octet-stream",[Pd]:e[Xs],[ef]:e[Ja],[Za]:e[Xa],[ja]:e[Qa]});t.bp("/model/{modelId}/invoke-with-response-stream"),t.p("modelId",()=>e.modelId,"{modelId}",!1);let n;if(e.body!==void 0)n=e.body;return t.m("POST").h(s).b(n),t.build()};var Ba=async(e,r)=>{if(e.statusCode!==200&&e.statusCode>=300)return za(e,r);const t=A({$metadata:b(e),[Dt]:[,e.headers[Qs]]}),s=await Ye(e.body,r);return t.body=s,t},Ga=async(e,r)=>{if(e.statusCode!==200&&e.statusCode>=300)return za(e,r);const t=A({$metadata:b(e),[Dt]:[,e.headers[Id]]}),s=e.body;return t.body=wd(s,r),t},za=async(e,r)=>{const t={...e,body:await et(e.body,r)},s=rt(e,t.body);switch(s){case"AccessDeniedException":case"com.amazonaws.bedrockruntime#AccessDeniedException":throw await ld(t,r);case"InternalServerException":case"com.amazonaws.bedrockruntime#InternalServerException":throw await Ha(t,r);case"ResourceNotFoundException":case"com.amazonaws.bedrockruntime#ResourceNotFoundException":throw await gd(t,r);case"ServiceQuotaExceededException":case"com.amazonaws.bedrockruntime#ServiceQuotaExceededException":throw await yd(t,r);case"ThrottlingException":case"com.amazonaws.bedrockruntime#ThrottlingException":throw await Va(t,r);case"ValidationException":case"com.amazonaws.bedrockruntime#ValidationException":throw await Ya(t,r);case"ModelErrorException":case"com.amazonaws.bedrockruntime#ModelErrorException":throw await md(t,r);case"ModelNotReadyException":case"com.amazonaws.bedrockruntime#ModelNotReadyException":throw await hd(t,r);case"ModelTimeoutException":case"com.amazonaws.bedrockruntime#ModelTimeoutException":throw await qa(t,r);case"ServiceUnavailableException":case"com.amazonaws.bedrockruntime#ServiceUnavailableException":throw await va(t,r);case"ModelStreamErrorException":case"com.amazonaws.bedrockruntime#ModelStreamErrorException":throw await Wa(t,r);default:const n=t.body;return dd({output:e,parsedBody:n,errorCode:s})}},dd=_r(x),ld=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new Mt({$metadata:b(e),...t});return T(i,e.body)},Ha=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new Tt({$metadata:b(e),...t});return T(i,e.body)},md=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S,originalStatusCode:br,resourceName:S});Object.assign(t,n);const i=new kt({$metadata:b(e),...t});return T(i,e.body)},hd=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new Ft({$metadata:b(e),...t});return T(i,e.body)},Wa=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S,originalMessage:S,originalStatusCode:br});Object.assign(t,n);const i=new $t({$metadata:b(e),...t});return T(i,e.body)},qa=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new xt({$metadata:b(e),...t});return T(i,e.body)},gd=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new Pt({$metadata:b(e),...t});return T(i,e.body)},yd=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new It({$metadata:b(e),...t});return T(i,e.body)},va=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new Ct({$metadata:b(e),...t});return T(i,e.body)},Va=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new Nt({$metadata:b(e),...t});return T(i,e.body)},Ya=async(e,r)=>{const t=A({}),s=e.body,n=R(s,{message:S});Object.assign(t,n);const i=new Ot({$metadata:b(e),...t});return T(i,e.body)};var wd=(e,r)=>{return r.eventStreamMarshaller.deserialize(e,async(t)=>{if(t.chunk!=null)return{chunk:await Ad(t.chunk,r)};if(t.internalServerException!=null)return{internalServerException:await pd(t.internalServerException,r)};if(t.modelStreamErrorException!=null)return{modelStreamErrorException:await Sd(t.modelStreamErrorException,r)};if(t.validationException!=null)return{validationException:await Md(t.validationException,r)};if(t.throttlingException!=null)return{throttlingException:await ud(t.throttlingException,r)};if(t.modelTimeoutException!=null)return{modelTimeoutException:await Ed(t.modelTimeoutException,r)};if(t.serviceUnavailableException!=null)return{serviceUnavailableException:await Rd(t.serviceUnavailableException,r)};return{$unknown:e}})};var pd=async(e,r)=>{const t={...e,body:await D(e.body,r)};return Ha(t,r)};var Sd=async(e,r)=>{const t={...e,body:await D(e.body,r)};return Wa(t,r)},Ed=async(e,r)=>{const t={...e,body:await D(e.body,r)};return qa(t,r)},Ad=async(e,r)=>{const t={},s=await D(e.body,r);return Object.assign(t,Td(s,r)),t},Rd=async(e,r)=>{const t={...e,body:await D(e.body,r)};return va(t,r)},ud=async(e,r)=>{const t={...e,body:await D(e.body,r)};return Va(t,r)},Md=async(e,r)=>{const t={...e,body:await D(e.body,r)};return Ya(t,r)};var Td=(e,r)=>{return R(e,{bytes:r.base64Decoder})};var b=(e)=>({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"]});var Ka=(e)=>e!==void 0&&e!==null&&e!==""&&(!Object.getOwnPropertyNames(e).includes("length")||e.length!=0)&&(!Object.getOwnPropertyNames(e).includes("size")||e.size!=0),Xs="accept",Dt="contentType",Qs="content-type",Xa="guardrailIdentifier",Qa="guardrailVersion",Ja="trace",Pd="x-amzn-bedrock-accept",Id="x-amzn-bedrock-content-type",Za="x-amzn-bedrock-guardrailidentifier",ja="x-amzn-bedrock-guardrailversion",ef="x-amzn-bedrock-trace";class Js extends G.classBuilder().ep({...At}).m(function(e,r,t,s){return[q(t,this.serialize,this.deserialize),v(t,e.getEndpointParameterInstructions())]}).s("AmazonBedrockFrontendService","InvokeModel",{}).n("BedrockRuntimeClient","InvokeModelCommand").f($a,Da).ser(La).de(Ba).build(){}class Zs extends G.classBuilder().ep({...At}).m(function(e,r,t,s){return[q(t,this.serialize,this.deserialize),v(t,e.getEndpointParameterInstructions())]}).s("AmazonBedrockFrontendService","InvokeModelWithResponseStream",{eventStream:{output:!0}}).n("BedrockRuntimeClient","InvokeModelWithResponseStreamCommand").f(Ua,ba).ser(_a).de(Ga).build(){}async function o1(e){be.debug(e);const r=new Js(e),t=await rf.send(r);return be.debug("Successfully invoke model"),be.debug(t),t}async function a1(e){be.debug(e);const r=new Zs(e),t=await rf.send(r);return be.debug("Successfully invoke model with response stream"),be.debug(t),t}var rf=new Hs({region:process.env.REGION||"us-east-1"}),be=console;export{xP as listFoundationModels,a1 as invokeModelWithResponseStream,o1 as invokeModel,FP as getModelCustomizationJob,kP as createModelCustomizationJob};
11
+
12
+ //# debugId=383A0CD6F391762E64756E2164756E21
69
13
  //# sourceMappingURL=index.js.map