@agentlang/lstudio 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/assets/{fs-Sy4Z_cXQ.js → fs-BFPzyhvM.js} +1 -1
  2. package/assets/index-BZcC_1YB.css +1 -0
  3. package/assets/{index-DgJXwFi2-COKHP7FV.js → index-Bz3SWrlh-BOC9aAgh.js} +1 -1
  4. package/assets/{index-KfLUFT2R.js → index-CWcv-6Zk.js} +619 -593
  5. package/assets/{index-DjgOAzh3.js → index-CuvfCO6A.js} +1 -1
  6. package/assets/{index-D4z_hbl0-azG0hCq3.js → index-D4z_hbl0-y_rvYJag.js} +1 -1
  7. package/assets/index-Dcg-T9P7.js +1 -0
  8. package/assets/index-Dsv5Y1bn.js +1 -0
  9. package/assets/index-hklP5STE-Bcq23IoH.js +17 -0
  10. package/assets/{index-8tk8u5Iu.js → index-v-qSLw3O.js} +1 -1
  11. package/assets/{index.browser-WNfWeocX.js → index.browser-CNuJpQRF.js} +4 -4
  12. package/assets/loadCognitoIdentity-CyU-paEc.js +1 -0
  13. package/assets/loadSts-_086JMFD.js +1 -0
  14. package/assets/{normalizeProvider-EC8cbfMc.js → normalizeProvider-BrOPyH3l.js} +1 -1
  15. package/assets/{replService-CwLBu50I.js → replService-zFxUAnXb.js} +1 -1
  16. package/assets/resolveDefaultsModeConfig-D1zWPouA.js +15 -0
  17. package/assets/{util-CLXELMCc.js → util-DRQhMG0c.js} +1 -1
  18. package/assets/{winston-1qzyIKCb-CLqf9ap0.js → winston-1qzyIKCb-DrBzcKjE.js} +1 -1
  19. package/assets/{winston-B8JOgq_0.js → winston-BBhfKzmi.js} +1 -1
  20. package/assets/{winston-CtxF18qc-kuRoprZ1.js → winston-CtxF18qc-R9Ff3XLo.js} +1 -1
  21. package/assets/{winston-_L517l6d.js → winston-oUPj17yo.js} +1 -1
  22. package/index.html +2 -2
  23. package/package.json +1 -1
  24. package/assets/AwsJson1_1Protocol-DqThCwVi.js +0 -1
  25. package/assets/index--S8Abk3Y.css +0 -1
  26. package/assets/index-3fspw9ap.js +0 -1
  27. package/assets/index-Bdy7oQ1C.js +0 -15
  28. package/assets/index-FnucrqzJ.js +0 -1
  29. package/assets/index-WGenATk8-DLiSeXer.js +0 -17
  30. package/assets/loadCognitoIdentity-CVCxF6wR.js +0 -1
  31. package/assets/loadSts-CIaNyXtH.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as ve}from"./util-CLXELMCc.js";import{k as Qo,l as Se,m as Xo,i as ye}from"./index-KfLUFT2R.js";import{a as ea,c as fe}from"./_commonjsHelpers-D6-XlEtG.js";import{r as re}from"./_commonjs-dynamic-modules-B7n8ZNar.js";var gt={},De={},mt,tn;function ae(){if(tn)return mt;tn=1;function e(h){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},e(h)}function u(h,s,f){return Object.defineProperty(h,"prototype",{writable:!1}),h}function m(h,s){if(!(h instanceof s))throw new TypeError("Cannot call a class as a function")}function R(h,s,f){return s=y(s),g(h,v()?Reflect.construct(s,f||[],y(h).constructor):s.apply(h,f))}function g(h,s){if(s&&(e(s)=="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return c(h)}function c(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function p(h,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");h.prototype=Object.create(s&&s.prototype,{constructor:{value:h,writable:!0,configurable:!0}}),Object.defineProperty(h,"prototype",{writable:!1}),s&&O(h,s)}function a(h){var s=typeof Map=="function"?new Map:void 0;return a=function(o){if(o===null||!b(o))return o;if(typeof o!="function")throw new TypeError("Super expression must either be null or a function");if(s!==void 0){if(s.has(o))return s.get(o);s.set(o,n)}function n(){return i(o,arguments,y(this).constructor)}return n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),O(n,o)},a(h)}function i(h,s,f){if(v())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,s);var n=new(h.bind.apply(h,o));return f&&O(n,f.prototype),n}function v(){try{var h=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(v=function(){return!!h})()}function b(h){try{return Function.toString.call(h).indexOf("[native code]")!==-1}catch{return typeof h=="function"}}function O(h,s){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(f,o){return f.__proto__=o,f},O(h,s)}function y(h){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},y(h)}var E=(function(h){function s(f){var o;return m(this,s),o=R(this,s,[`Format functions must be synchronous taking a two arguments: (info, opts)
1
+ import{r as ve}from"./util-DRQhMG0c.js";import{k as Qo,l as Se,m as Xo,i as ye}from"./index-CWcv-6Zk.js";import{a as ea,c as fe}from"./_commonjsHelpers-D6-XlEtG.js";import{r as re}from"./_commonjs-dynamic-modules-B7n8ZNar.js";var gt={},De={},mt,tn;function ae(){if(tn)return mt;tn=1;function e(h){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(s){return typeof s}:function(s){return s&&typeof Symbol=="function"&&s.constructor===Symbol&&s!==Symbol.prototype?"symbol":typeof s},e(h)}function u(h,s,f){return Object.defineProperty(h,"prototype",{writable:!1}),h}function m(h,s){if(!(h instanceof s))throw new TypeError("Cannot call a class as a function")}function R(h,s,f){return s=y(s),g(h,v()?Reflect.construct(s,f||[],y(h).constructor):s.apply(h,f))}function g(h,s){if(s&&(e(s)=="object"||typeof s=="function"))return s;if(s!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return c(h)}function c(h){if(h===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return h}function p(h,s){if(typeof s!="function"&&s!==null)throw new TypeError("Super expression must either be null or a function");h.prototype=Object.create(s&&s.prototype,{constructor:{value:h,writable:!0,configurable:!0}}),Object.defineProperty(h,"prototype",{writable:!1}),s&&O(h,s)}function a(h){var s=typeof Map=="function"?new Map:void 0;return a=function(o){if(o===null||!b(o))return o;if(typeof o!="function")throw new TypeError("Super expression must either be null or a function");if(s!==void 0){if(s.has(o))return s.get(o);s.set(o,n)}function n(){return i(o,arguments,y(this).constructor)}return n.prototype=Object.create(o.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),O(n,o)},a(h)}function i(h,s,f){if(v())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,s);var n=new(h.bind.apply(h,o));return f&&O(n,f.prototype),n}function v(){try{var h=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(v=function(){return!!h})()}function b(h){try{return Function.toString.call(h).indexOf("[native code]")!==-1}catch{return typeof h=="function"}}function O(h,s){return O=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(f,o){return f.__proto__=o,f},O(h,s)}function y(h){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(s){return s.__proto__||Object.getPrototypeOf(s)},y(h)}var E=(function(h){function s(f){var o;return m(this,s),o=R(this,s,[`Format functions must be synchronous taking a two arguments: (info, opts)
2
2
  Found: `.concat(f.toString().split(`
3
3
  `)[0],`
4
4
  `)]),Error.captureStackTrace(o,s),o}return p(s,h),u(s)})(a(Error));return mt=function(h){if(h.length>2)throw new E(h);function s(){var o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.options=o}s.prototype.transform=h;function f(o){return new s(o)}return f.Format=s,f},mt}var je={exports:{}},bt={exports:{}},_t={exports:{}},wt={exports:{}},rn;function ta(){return rn||(rn=1,(function(e){var u={};e.exports=u;var m={reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29],black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39],grey:[90,39],brightRed:[91,39],brightGreen:[92,39],brightYellow:[93,39],brightBlue:[94,39],brightMagenta:[95,39],brightCyan:[96,39],brightWhite:[97,39],bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgGray:[100,49],bgGrey:[100,49],bgBrightRed:[101,49],bgBrightGreen:[102,49],bgBrightYellow:[103,49],bgBrightBlue:[104,49],bgBrightMagenta:[105,49],bgBrightCyan:[106,49],bgBrightWhite:[107,49],blackBG:[40,49],redBG:[41,49],greenBG:[42,49],yellowBG:[43,49],blueBG:[44,49],magentaBG:[45,49],cyanBG:[46,49],whiteBG:[47,49]};Object.keys(m).forEach(function(R){var g=m[R],c=u[R]=[];c.open="\x1B["+g[0]+"m",c.close="\x1B["+g[1]+"m"})})(wt)),wt.exports}var St,nn;function ra(){return nn||(nn=1,St=function(e,u){u=u||process.argv||[];var m=u.indexOf("--"),R=/^-{1,2}/.test(e)?"":"--",g=u.indexOf(R+e);return g!==-1&&(m===-1?!0:g<m)}),St}var Et,on;function na(){if(on)return Et;on=1;var e={},u=ra(),m=e,R=void 0;u("no-color")||u("no-colors")||u("color=false")?R=!1:(u("color")||u("colors")||u("color=true")||u("color=always"))&&(R=!0),"FORCE_COLOR"in m&&(R=m.FORCE_COLOR.length===0||parseInt(m.FORCE_COLOR,10)!==0);function g(a){return a===0?!1:{level:a,hasBasic:!0,has256:a>=2,has16m:a>=3}}function c(a){if(R===!1)return 0;if(u("color=16m")||u("color=full")||u("color=truecolor"))return 3;if(u("color=256"))return 2;if(a&&!a.isTTY&&R!==!0)return 0;var i=R?1:0;if("CI"in m)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some(function(b){return b in m})||m.CI_NAME==="codeship"?1:i;if("TEAMCITY_VERSION"in m)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(m.TEAMCITY_VERSION)?1:0;if("TERM_PROGRAM"in m){var v=parseInt((m.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(m.TERM_PROGRAM){case"iTerm.app":return v>=3?3:2;case"Hyper":return 3;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(m.TERM)?2:/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(m.TERM)||"COLORTERM"in m?1:(m.TERM==="dumb",i)}function p(a){var i=c(a);return g(i)}return Et={supportsColor:p,stdout:p(process.stdout),stderr:p(process.stderr)},Et}var Rt={exports:{}},an;function ia(){return an||(an=1,(function(e){e.exports=function(m,R){var g="";m=m||"Run the trap, drop the bass",m=m.split("");var c={a:["@","Ą","Ⱥ","Ʌ","Δ","Λ","Д"],b:["ß","Ɓ","Ƀ","ɮ","β","฿"],c:["©","Ȼ","Ͼ"],d:["Ð","Ɗ","Ԁ","ԁ","Ԃ","ԃ"],e:["Ë","ĕ","Ǝ","ɘ","Σ","ξ","Ҽ","੬"],f:["Ӻ"],g:["ɢ"],h:["Ħ","ƕ","Ң","Һ","Ӈ","Ԋ"],i:["༏"],j:["Ĵ"],k:["ĸ","Ҡ","Ӄ","Ԟ"],l:["Ĺ"],m:["ʍ","Ӎ","ӎ","Ԡ","ԡ","൩"],n:["Ñ","ŋ","Ɲ","Ͷ","Π","Ҋ"],o:["Ø","õ","ø","Ǿ","ʘ","Ѻ","ם","۝","๏"],p:["Ƿ","Ҏ"],q:["্"],r:["®","Ʀ","Ȑ","Ɍ","ʀ","Я"],s:["§","Ϟ","ϟ","Ϩ"],t:["Ł","Ŧ","ͳ"],u:["Ʊ","Ս"],v:["ט"],w:["Ш","Ѡ","Ѽ","൰"],x:["Ҳ","Ӿ","Ӽ","ӽ"],y:["¥","Ұ","Ӌ"],z:["Ƶ","ɀ"]};return m.forEach(function(p){p=p.toLowerCase();var a=c[p]||[" "],i=Math.floor(Math.random()*a.length);typeof c[p]<"u"?g+=c[p][i]:g+=p}),g}})(Rt)),Rt.exports}var Ot={exports:{}},un;function oa(){return un||(un=1,(function(e){e.exports=function(m,R){m=m||" he is here ";var g={up:["̍","̎","̄","̅","̿","̑","̆","̐","͒","͗","͑","̇","̈","̊","͂","̓","̈","͊","͋","͌","̃","̂","̌","͐","̀","́","̋","̏","̒","̓","̔","̽","̉","ͣ","ͤ","ͥ","ͦ","ͧ","ͨ","ͩ","ͪ","ͫ","ͬ","ͭ","ͮ","ͯ","̾","͛","͆","̚"],down:["̖","̗","̘","̙","̜","̝","̞","̟","̠","̤","̥","̦","̩","̪","̫","̬","̭","̮","̯","̰","̱","̲","̳","̹","̺","̻","̼","ͅ","͇","͈","͉","͍","͎","͓","͔","͕","͖","͙","͚","̣"],mid:["̕","̛","̀","́","͘","̡","̢","̧","̨","̴","̵","̶","͜","͝","͞","͟","͠","͢","̸","̷","͡"," ҉"]},c=[].concat(g.up,g.down,g.mid);function p(v){var b=Math.floor(Math.random()*v);return b}function a(v){var b=!1;return c.filter(function(O){b=O===v}),b}function i(v,b){var O="",y,E;b=b||{},b.up=typeof b.up<"u"?b.up:!0,b.mid=typeof b.mid<"u"?b.mid:!0,b.down=typeof b.down<"u"?b.down:!0,b.size=typeof b.size<"u"?b.size:"maxi",v=v.split("");for(E in v)if(!a(E)){switch(O=O+v[E],y={up:0,down:0,mid:0},b.size){case"mini":y.up=p(8),y.mid=p(2),y.down=p(8);break;case"maxi":y.up=p(16)+3,y.mid=p(4)+1,y.down=p(64)+3;break;default:y.up=p(8)+1,y.mid=p(6)/2,y.down=p(8)+1;break}var h=["up","mid","down"];for(var s in h)for(var f=h[s],o=0;o<=y[f];o++)b[f]&&(O=O+g[f][p(g[f].length)])}return O}return i(m,R)}})(Ot)),Ot.exports}var Pt={exports:{}},sn;function aa(){return sn||(sn=1,(function(e){e.exports=function(u){return function(m,R,g){if(m===" ")return m;switch(R%3){case 0:return u.red(m);case 1:return u.white(m);case 2:return u.blue(m)}}}})(Pt)),Pt.exports}var Tt={exports:{}},fn;function ua(){return fn||(fn=1,(function(e){e.exports=function(u){return function(m,R,g){return R%2===0?m:u.inverse(m)}}})(Tt)),Tt.exports}var jt={exports:{}},ln;function sa(){return ln||(ln=1,(function(e){e.exports=function(u){var m=["red","yellow","green","blue","magenta"];return function(R,g,c){return R===" "?R:u[m[g++%m.length]](R)}}})(jt)),jt.exports}var Mt={exports:{}},cn;function fa(){return cn||(cn=1,(function(e){e.exports=function(u){var m=["underline","inverse","grey","yellow","red","green","blue","white","cyan","magenta","brightYellow","brightRed","brightGreen","brightBlue","brightWhite","brightCyan","brightMagenta"];return function(R,g,c){return R===" "?R:u[m[Math.round(Math.random()*(m.length-2))]](R)}}})(Mt)),Mt.exports}var dn;function la(){return dn||(dn=1,(function(e){var u={};e.exports=u,u.themes={};var m=ve(),R=u.styles=ta(),g=Object.defineProperties,c=new RegExp(/[\r\n]+/g);u.supportsColor=na().supportsColor,typeof u.enabled>"u"&&(u.enabled=u.supportsColor()!==!1),u.enable=function(){u.enabled=!0},u.disable=function(){u.enabled=!1},u.stripColors=u.strip=function(s){return(""+s).replace(/\x1B\[\d+m/g,"")},u.stylize=function(f,o){if(!u.enabled)return f+"";var n=R[o];return!n&&o in u?u[o](f):n.open+f+n.close};var p=/[|\\{}()[\]^$+*?.]/g,a=function(s){if(typeof s!="string")throw new TypeError("Expected a string");return s.replace(p,"\\$&")};function i(s){var f=function o(){return O.apply(o,arguments)};return f._styles=s,f.__proto__=b,f}var v=(function(){var s={};return R.grey=R.gray,Object.keys(R).forEach(function(f){R[f].closeRe=new RegExp(a(R[f].close),"g"),s[f]={get:function(){return i(this._styles.concat(f))}}}),s})(),b=g(function(){},v);function O(){var s=Array.prototype.slice.call(arguments),f=s.map(function(_){return _!=null&&_.constructor===String?_:m.inspect(_)}).join(" ");if(!u.enabled||!f)return f;for(var o=f.indexOf(`
package/index.html CHANGED
@@ -10,7 +10,7 @@
10
10
  <link rel="preconnect" href="https://fonts.googleapis.com">
11
11
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
12
12
  <link href="https://fonts.googleapis.com/css2?family=Oxanium:wght@200..800&display=swap" rel="stylesheet">
13
- <script type="module" crossorigin src="/assets/index-KfLUFT2R.js"></script>
13
+ <script type="module" crossorigin src="/assets/index-CWcv-6Zk.js"></script>
14
14
  <link rel="modulepreload" crossorigin href="/assets/_commonjsHelpers-D6-XlEtG.js">
15
15
  <link rel="modulepreload" crossorigin href="/assets/index-ChvoNxcO.js">
16
16
  <link rel="modulepreload" crossorigin href="/assets/preload-helper-BlTxHScW.js">
@@ -25,7 +25,7 @@
25
25
  <link rel="modulepreload" crossorigin href="/assets/index.browser-BHPvGrwi-6Mh8eUw-.js">
26
26
  <link rel="modulepreload" crossorigin href="/assets/_commonjs-dynamic-modules-BpilXLfW-DfYEAvWy.js">
27
27
  <link rel="modulepreload" crossorigin href="/assets/_commonjs-dynamic-modules-B7n8ZNar.js">
28
- <link rel="stylesheet" crossorigin href="/assets/index--S8Abk3Y.css">
28
+ <link rel="stylesheet" crossorigin href="/assets/index-BZcC_1YB.css">
29
29
  </head>
30
30
  <body>
31
31
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentlang/lstudio",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "files": [
@@ -1 +0,0 @@
1
- import{N as h,c as T,S as y,b as p,U as N,d as _,L as w,e as b,f as R,v as E,R as z,P as J,h as M,T as j}from"./index-Bdy7oQ1C.js";import{t as D,a as I,p as k,b as A,c as O,d as S,e as B}from"./normalizeProvider-EC8cbfMc.js";function U(f,t,e){if(e?.source){const i=e.source;if(typeof t=="number"&&(t>Number.MAX_SAFE_INTEGER||t<Number.MIN_SAFE_INTEGER||i!==String(t)))return i.includes(".")?new h(i,"bigDecimal"):BigInt(i)}return t}const $=(f,t)=>T(f,t).then(e=>(t?.utf8Encoder??D)(e)),Q=(f,t)=>$(f,t).then(e=>{if(e.length)try{return JSON.parse(e)}catch(i){throw i?.name==="SyntaxError"&&Object.defineProperty(i,"$responseBodyText",{value:e}),i}return{}}),V=(f,t)=>{const e=(n,r)=>Object.keys(n).find(o=>o.toLowerCase()===r.toLowerCase()),i=n=>{let r=n;return typeof r=="number"&&(r=r.toString()),r.indexOf(",")>=0&&(r=r.split(",")[0]),r.indexOf(":")>=0&&(r=r.split(":")[0]),r.indexOf("#")>=0&&(r=r.split("#")[1]),r},s=e(f.headers,"x-amzn-errortype");if(s!==void 0)return i(f.headers[s]);if(t&&typeof t=="object"){const n=e(t,"code");if(n&&t[n]!==void 0)return i(t[n]);if(t.__type!==void 0)return i(t.__type)}};class L extends y{settings;constructor(t){super(),this.settings=t}async read(t,e){return this._read(t,typeof e=="string"?JSON.parse(e,U):await Q(e,this.serdeContext))}readObject(t,e){return this._read(t,e)}_read(t,e){const i=e!==null&&typeof e=="object",s=p.of(t);if(i){if(s.isStructSchema()){const r=s.isUnionSchema(),o={};let c;r&&(c=new N(e,o));for(const[a,m]of _(s,e,this.settings.jsonName?"jsonName":!1)){const u=this.settings.jsonName?m.getMergedTraits().jsonName??a:a;r&&c.mark(u),e[u]!=null&&(o[a]=this._read(m,e[u]))}return r&&c.writeUnknown(),o}if(Array.isArray(e)&&s.isListSchema()){const r=s.getValueSchema(),o=[],c=!!s.getMergedTraits().sparse;for(const a of e)(c||a!=null)&&o.push(this._read(r,a));return o}if(s.isMapSchema()){const r=s.getValueSchema(),o={},c=!!s.getMergedTraits().sparse;for(const[a,m]of Object.entries(e))(c||m!=null)&&(o[a]=this._read(r,m));return o}}if(s.isBlobSchema()&&typeof e=="string")return I(e);const n=s.getMergedTraits().mediaType;if(s.isStringSchema()&&typeof e=="string"&&n)return n==="application/json"||n.endsWith("+json")?w.from(e):e;if(s.isTimestampSchema()&&e!=null)switch(b(s,this.settings)){case 5:return O(e);case 6:return A(e);case 7:return k(e);default:return console.warn("Missing timestamp format, parsing value with Date constructor:",e),new Date(e)}if(s.isBigIntegerSchema()&&(typeof e=="number"||typeof e=="string"))return BigInt(e);if(s.isBigDecimalSchema()&&e!=null){if(e instanceof h)return e;const r=e;return r.type==="bigDecimal"&&"string"in r?new h(r.string,r.type):new h(String(e),"bigDecimal")}if(s.isNumericSchema()&&typeof e=="string"){switch(e){case"Infinity":return 1/0;case"-Infinity":return-1/0;case"NaN":return NaN}return e}if(s.isDocumentSchema())if(i){const r=Array.isArray(e)?[]:{};for(const[o,c]of Object.entries(e))c instanceof h?r[o]=c:r[o]=this._read(s,c);return r}else return structuredClone(e);return e}}const l="Ν";class P{values=new Map;counter=0;stage=0;createReplacer(){if(this.stage===1)throw new Error("@aws-sdk/core/protocols - JsonReplacer already created.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");return this.stage=1,(t,e)=>{if(e instanceof h){const i=`${l+"nv"+this.counter++}_`+e.string;return this.values.set(`"${i}"`,e.string),i}if(typeof e=="bigint"){const i=e.toString(),s=`${l+"b"+this.counter++}_`+i;return this.values.set(`"${s}"`,i),s}return e}}replaceInJson(t){if(this.stage===0)throw new Error("@aws-sdk/core/protocols - JsonReplacer not created yet.");if(this.stage===2)throw new Error("@aws-sdk/core/protocols - JsonReplacer exhausted.");if(this.stage=2,this.counter===0)return t;for(const[e,i]of this.values)t=t.replace(e,i);return t}}class F extends y{settings;buffer;useReplacer=!1;rootSchema;constructor(t){super(),this.settings=t}write(t,e){this.rootSchema=p.of(t),this.buffer=this._write(this.rootSchema,e)}writeDiscriminatedDocument(t,e){this.write(t,e),typeof this.buffer=="object"&&(this.buffer.__type=p.of(t).getName(!0))}flush(){const{rootSchema:t,useReplacer:e}=this;if(this.rootSchema=void 0,this.useReplacer=!1,t?.isStructSchema()||t?.isDocumentSchema()){if(!e)return JSON.stringify(this.buffer);const i=new P;return i.replaceInJson(JSON.stringify(this.buffer,i.createReplacer(),0))}return this.buffer}_write(t,e,i){const s=e!==null&&typeof e=="object",n=p.of(t);if(s){if(n.isStructSchema()){const r={};for(const[o,c]of R(n,e)){const a=this._write(c,e[o],n);if(a!==void 0){const m=c.getMergedTraits().jsonName,u=this.settings.jsonName?m??o:o;r[u]=a}}if(n.isUnionSchema()&&Object.keys(r).length===0){const{$unknown:o}=e;if(Array.isArray(o)){const[c,a]=o;r[c]=this._write(15,a)}}return r}if(Array.isArray(e)&&n.isListSchema()){const r=n.getValueSchema(),o=[],c=!!n.getMergedTraits().sparse;for(const a of e)(c||a!=null)&&o.push(this._write(r,a));return o}if(n.isMapSchema()){const r=n.getValueSchema(),o={},c=!!n.getMergedTraits().sparse;for(const[a,m]of Object.entries(e))(c||m!=null)&&(o[a]=this._write(r,m));return o}if(e instanceof Uint8Array&&(n.isBlobSchema()||n.isDocumentSchema()))return n===this.rootSchema?e:(this.serdeContext?.base64Encoder??S)(e);if(e instanceof Date&&(n.isTimestampSchema()||n.isDocumentSchema()))switch(b(n,this.settings)){case 5:return e.toISOString().replace(".000Z","Z");case 6:return B(e);case 7:return e.getTime()/1e3;default:return console.warn("Missing timestamp format, using epoch seconds",e),e.getTime()/1e3}e instanceof h&&(this.useReplacer=!0)}if(!(e===null&&i?.isStructSchema())){if(n.isStringSchema()){if(typeof e>"u"&&n.isIdempotencyToken())return E();const r=n.getMergedTraits().mediaType;return e!=null&&r&&(r==="application/json"||r.endsWith("+json"))?w.from(e):e}if(typeof e=="number"&&n.isNumericSchema())return Math.abs(e)===1/0||isNaN(e)?String(e):e;if(typeof e=="string"&&n.isBlobSchema())return n===this.rootSchema?e:(this.serdeContext?.base64Encoder??S)(e);if(typeof e=="bigint"&&(this.useReplacer=!0),n.isDocumentSchema())if(s){const r=Array.isArray(e)?[]:{};for(const[o,c]of Object.entries(e))c instanceof h?(this.useReplacer=!0,r[o]=c):r[o]=this._write(n,c);return r}else return structuredClone(e);return e}}}class q extends y{settings;constructor(t){super(),this.settings=t}createSerializer(){const t=new F(this.settings);return t.setSerdeContext(this.serdeContext),t}createDeserializer(){const t=new L(this.settings);return t.setSerdeContext(this.serdeContext),t}}class K extends z{serializer;deserializer;serviceTarget;codec;mixin;awsQueryCompatible;constructor({defaultNamespace:t,serviceTarget:e,awsQueryCompatible:i,jsonCodec:s}){super({defaultNamespace:t}),this.serviceTarget=e,this.codec=s??new q({timestampFormat:{useTrait:!0,default:7},jsonName:!1}),this.serializer=this.codec.createSerializer(),this.deserializer=this.codec.createDeserializer(),this.awsQueryCompatible=!!i,this.mixin=new J(this.awsQueryCompatible)}async serializeRequest(t,e,i){const s=await super.serializeRequest(t,e,i);return s.path.endsWith("/")||(s.path+="/"),Object.assign(s.headers,{"content-type":`application/x-amz-json-${this.getJsonRpcVersion()}`,"x-amz-target":`${this.serviceTarget}.${t.name}`}),this.awsQueryCompatible&&(s.headers["x-amzn-query-mode"]="true"),(M(t.input)==="unit"||!s.body)&&(s.body="{}"),s}getPayloadCodec(){return this.codec}async handleError(t,e,i,s,n){this.awsQueryCompatible&&this.mixin.setQueryCompatError(s,i);const r=V(i,s)??"Unknown",{errorSchema:o,errorMetadata:c}=await this.mixin.getErrorSchemaOrThrowBaseException(r,this.options.defaultNamespace,i,s,n,this.awsQueryCompatible?this.mixin.findQueryCompatibleError:void 0),a=p.of(o),m=s.message??s.Message??"Unknown",u=j.for(o[1]).getErrorCtor(o)??Error,x=new u(m),d={};for(const[g,C]of a.structIterator())s[g]!=null&&(d[g]=this.codec.createDeserializer().readObject(C,s[g]));throw this.awsQueryCompatible&&this.mixin.queryCompatOutput(s,d),this.mixin.decorateServiceException(Object.assign(x,c,{$fault:a.getMergedTraits().error,message:m},d),s)}}class Z extends K{constructor({defaultNamespace:t,serviceTarget:e,awsQueryCompatible:i,jsonCodec:s}){super({defaultNamespace:t,serviceTarget:e,awsQueryCompatible:i,jsonCodec:s})}getShapeId(){return"aws.protocols#awsJson1_1"}getJsonRpcVersion(){return"1.1"}getDefaultContentType(){return"application/x-amz-json-1.1"}}export{Z as A};