@nvwa-app/sdk-core 0.11.0 → 2.0.0

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.d.mts CHANGED
@@ -158,7 +158,9 @@ type FunctionInvokeOptions = {
158
158
  };
159
159
  declare class NvwaEdgeFunctions {
160
160
  protected http: NvwaHttpClient;
161
- constructor(http: NvwaHttpClient);
161
+ /** 项目 backend 根地址(如 https://xxx.nvwa.app),请求会发往此 host 而非当前页 origin */
162
+ protected baseUrl: string;
163
+ constructor(http: NvwaHttpClient, baseUrl?: string);
162
164
  invoke<T = any>(name: string, options: FunctionInvokeOptions): Promise<T>;
163
165
  }
164
166
 
package/dist/index.d.ts CHANGED
@@ -158,7 +158,9 @@ type FunctionInvokeOptions = {
158
158
  };
159
159
  declare class NvwaEdgeFunctions {
160
160
  protected http: NvwaHttpClient;
161
- constructor(http: NvwaHttpClient);
161
+ /** 项目 backend 根地址(如 https://xxx.nvwa.app),请求会发往此 host 而非当前页 origin */
162
+ protected baseUrl: string;
163
+ constructor(http: NvwaHttpClient, baseUrl?: string);
162
164
  invoke<T = any>(name: string, options: FunctionInvokeOptions): Promise<T>;
163
165
  }
164
166
 
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var st=Object.create;var L=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var pe=(s,e)=>()=>(s&&(e=s(s=0)),e);var _=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),fe=(s,e)=>{for(var t in e)L(s,t,{get:e[t],enumerable:!0})},me=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ot(e))!at.call(s,n)&&n!==t&&L(s,n,{get:()=>e[n],enumerable:!(r=nt(e,n))||r.enumerable});return s};var lt=(s,e,t)=>(t=s!=null?st(it(s)):{},me(e||!s||!s.__esModule?L(t,"default",{value:s,enumerable:!0}):t,s)),E=s=>me(L({},"__esModule",{value:!0}),s);var h=pe(()=>{"use strict"});var x={};fe(x,{__addDisposableResource:()=>Fe,__assign:()=>N,__asyncDelegator:()=>Ue,__asyncGenerator:()=>Ie,__asyncValues:()=>Le,__await:()=>T,__awaiter:()=>Te,__classPrivateFieldGet:()=>qe,__classPrivateFieldIn:()=>Be,__classPrivateFieldSet:()=>De,__createBinding:()=>M,__decorate:()=>Pe,__disposeResources:()=>ze,__esDecorate:()=>Ee,__exportStar:()=>je,__extends:()=>we,__generator:()=>Re,__importDefault:()=>Me,__importStar:()=>ke,__makeTemplateObject:()=>Ne,__metadata:()=>$e,__param:()=>_e,__propKey:()=>Oe,__read:()=>J,__rest:()=>be,__rewriteRelativeImportExtension:()=>Ge,__runInitializers:()=>xe,__setFunctionName:()=>Se,__spread:()=>He,__spreadArray:()=>Ae,__spreadArrays:()=>Ce,__values:()=>k,default:()=>pt});function we(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");z(s,e);function t(){this.constructor=s}s.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function be(s,e){var t={};for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&e.indexOf(r)<0&&(t[r]=s[r]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(s);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(s,r[n])&&(t[r[n]]=s[r[n]]);return t}function Pe(s,e,t,r){var n=arguments.length,o=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,r);else for(var a=s.length-1;a>=0;a--)(i=s[a])&&(o=(n<3?i(o):n>3?i(e,t,o):i(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o}function _e(s,e){return function(t,r){e(t,r,s)}}function Ee(s,e,t,r,n,o){function i(P){if(P!==void 0&&typeof P!="function")throw new TypeError("Function expected");return P}for(var a=r.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!e&&s?r.static?s:s.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,m=!1,p=t.length-1;p>=0;p--){var y={};for(var b in r)y[b]=b==="access"?{}:r[b];for(var b in r.access)y.access[b]=r.access[b];y.addInitializer=function(P){if(m)throw new TypeError("Cannot add initializers after decoration has completed");o.push(i(P||null))};var g=(0,t[p])(a==="accessor"?{get:u.get,set:u.set}:u[c],y);if(a==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=i(g.get))&&(u.get=d),(d=i(g.set))&&(u.set=d),(d=i(g.init))&&n.unshift(d)}else(d=i(g))&&(a==="field"?n.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),m=!0}function xe(s,e,t){for(var r=arguments.length>2,n=0;n<e.length;n++)t=r?e[n].call(s,t):e[n].call(s);return r?t:void 0}function Oe(s){return typeof s=="symbol"?s:"".concat(s)}function Se(s,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(s,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function $e(s,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,e)}function Te(s,e,t,r){function n(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{l(r.next(u))}catch(d){i(d)}}function c(u){try{l(r.throw(u))}catch(d){i(d)}}function l(u){u.done?o(u.value):n(u.value).then(a,c)}l((r=r.apply(s,e||[])).next())})}function Re(s,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(t=0)),t;)try{if(r=1,n&&(o=l[0]&2?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,n=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){t.label=l[1];break}if(l[0]===6&&t.label<o[1]){t.label=o[1],o=l;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(l);break}o[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(s,t)}catch(u){l=[6,u],n=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function je(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&M(e,s,t)}function k(s){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&s[e],r=0;if(t)return t.call(s);if(s&&typeof s.length=="number")return{next:function(){return s&&r>=s.length&&(s=void 0),{value:s&&s[r++],done:!s}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function J(s,e){var t=typeof Symbol=="function"&&s[Symbol.iterator];if(!t)return s;var r=t.call(s),n,o=[],i;try{for(;(e===void 0||e-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(a){i={error:a}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o}function He(){for(var s=[],e=0;e<arguments.length;e++)s=s.concat(J(arguments[e]));return s}function Ce(){for(var s=0,e=0,t=arguments.length;e<t;e++)s+=arguments[e].length;for(var r=Array(s),n=0,e=0;e<t;e++)for(var o=arguments[e],i=0,a=o.length;i<a;i++,n++)r[n]=o[i];return r}function Ae(s,e,t){if(t||arguments.length===2)for(var r=0,n=e.length,o;r<n;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return s.concat(o||Array.prototype.slice.call(e))}function T(s){return this instanceof T?(this.v=s,this):new T(s)}function Ie(s,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(s,e||[]),n,o=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),n[Symbol.asyncIterator]=function(){return this},n;function i(p){return function(y){return Promise.resolve(y).then(p,d)}}function a(p,y){r[p]&&(n[p]=function(b){return new Promise(function(g,P){o.push([p,b,g,P])>1||c(p,b)})},y&&(n[p]=y(n[p])))}function c(p,y){try{l(r[p](y))}catch(b){m(o[0][3],b)}}function l(p){p.value instanceof T?Promise.resolve(p.value.v).then(u,d):m(o[0][2],p)}function u(p){c("next",p)}function d(p){c("throw",p)}function m(p,y){p(y),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Ue(s){var e,t;return e={},r("next"),r("throw",function(n){throw n}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(n,o){e[n]=s[n]?function(i){return(t=!t)?{value:T(s[n](i)),done:!1}:o?o(i):i}:o}}function Le(s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=s[Symbol.asyncIterator],t;return e?e.call(s):(s=typeof k=="function"?k(s):s[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=s[o]&&function(i){return new Promise(function(a,c){i=s[o](i),n(a,c,i.done,i.value)})}}function n(o,i,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},i)}}function Ne(s,e){return Object.defineProperty?Object.defineProperty(s,"raw",{value:e}):s.raw=e,s}function ke(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t=G(s),r=0;r<t.length;r++)t[r]!=="default"&&M(e,s,t[r]);return ut(e,s),e}function Me(s){return s&&s.__esModule?s:{default:s}}function qe(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)}function De(s,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(s,t):n?n.value=t:e.set(s,t),t}function Be(s,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof s=="function"?e===s:s.has(e)}function Fe(s,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,n;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],t&&(n=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");n&&(r=function(){try{n.call(this)}catch(o){return Promise.reject(o)}}),s.stack.push({value:e,dispose:r,async:t})}else t&&s.stack.push({async:!0});return e}function ze(s){function e(o){s.error=s.hasError?new dt(o,s.error,"An error was suppressed during disposal."):o,s.hasError=!0}var t,r=0;function n(){for(;t=s.stack.pop();)try{if(!t.async&&r===1)return r=0,s.stack.push(t),Promise.resolve().then(n);if(t.dispose){var o=t.dispose.call(t.value);if(t.async)return r|=2,Promise.resolve(o).then(n,function(i){return e(i),n()})}else r|=1}catch(i){e(i)}if(r===1)return s.hasError?Promise.reject(s.error):Promise.resolve();if(s.hasError)throw s.error}return n()}function Ge(s,e){return typeof s=="string"&&/^\.\.?\//.test(s)?s.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,n,o,i){return r?e?".jsx":".js":n&&(!o||!i)?t:n+o+"."+i.toLowerCase()+"js"}):s}var z,N,M,ut,G,dt,pt,O=pe(()=>{"use strict";h();z=function(s,e){return z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},z(s,e)};N=function(){return N=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},N.apply(this,arguments)};M=Object.create?(function(s,e,t,r){r===void 0&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,n)}):(function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]});ut=Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e},G=function(s){return G=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},G(s)};dt=typeof SuppressedError=="function"?SuppressedError:function(s,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=s,r.suppressed=e,r};pt={__extends:we,__assign:N,__rest:be,__decorate:Pe,__param:_e,__esDecorate:Ee,__runInitializers:xe,__propKey:Oe,__setFunctionName:Se,__metadata:$e,__awaiter:Te,__generator:Re,__createBinding:M,__exportStar:je,__values:k,__read:J,__spread:He,__spreadArrays:Ce,__spreadArray:Ae,__await:T,__asyncGenerator:Ie,__asyncDelegator:Ue,__asyncValues:Le,__makeTemplateObject:Ne,__importStar:ke,__importDefault:Me,__classPrivateFieldGet:qe,__classPrivateFieldSet:De,__classPrivateFieldIn:Be,__addDisposableResource:Fe,__disposeResources:ze,__rewriteRelativeImportExtension:Ge}});var Y=_(V=>{"use strict";h();Object.defineProperty(V,"__esModule",{value:!0});var W=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};V.default=W});var X=_(K=>{"use strict";h();Object.defineProperty(K,"__esModule",{value:!0});var ft=(O(),E(x)),mt=ft.__importDefault(Y()),Q=class{constructor(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let r=this.fetch,n=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{var i,a,c,l;let u=null,d=null,m=null,p=o.status,y=o.statusText;if(o.ok){if(this.method!=="HEAD"){let U=await o.text();U===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text"))?d=U:d=JSON.parse(U))}let g=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),P=(c=o.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");g&&P&&P.length>1&&(m=parseInt(P[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,m=null,p=406,y="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let g=await o.text();try{u=JSON.parse(g),Array.isArray(u)&&o.status===404&&(d=[],u=null,p=200,y="OK")}catch{o.status===404&&g===""?(p=204,y="No Content"):u={message:g}}if(u&&this.isMaybeSingle&&(!((l=u?.details)===null||l===void 0)&&l.includes("0 rows"))&&(u=null,p=200,y="OK"),u&&this.shouldThrowOnError)throw new mt.default(u)}return{error:u,data:d,count:m,status:p,statusText:y}});return this.shouldThrowOnError||(n=n.catch(o=>{var i,a,c;return{error:{message:`${(i=o?.name)!==null&&i!==void 0?i:"FetchError"}: ${o?.message}`,details:`${(a=o?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(c=o?.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),n.then(e,t)}returns(){return this}overrideTypes(){return this}};K.default=Q});var te=_(ee=>{"use strict";h();Object.defineProperty(ee,"__esModule",{value:!0});var yt=(O(),E(x)),gt=yt.__importDefault(X()),Z=class extends gt.default{select(e){let t=!1,r=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:o=n}={}){let i=o?`${o}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){let o=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(o,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:o=!1,format:i="text"}={}){var a;let c=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,o?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${c};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};ee.default=Z});var q=_(se=>{"use strict";h();Object.defineProperty(se,"__esModule",{value:!0});var vt=(O(),E(x)),wt=vt.__importDefault(te()),bt=new RegExp("[,()]"),re=class extends wt.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(n=>typeof n=="string"&&bt.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let o="";n==="plain"?o="pl":n==="phrase"?o="ph":n==="websearch"&&(o="w");let i=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${o}fts${i}.${t}`),this}match(e){return Object.entries(e).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}};se.default=re});var ie=_(oe=>{"use strict";h();Object.defineProperty(oe,"__esModule",{value:!0});var Pt=(O(),E(x)),I=Pt.__importDefault(q()),ne=class{constructor(e,{headers:t={},schema:r,fetch:n}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n}select(e,t){let{head:r=!1,count:n}=t??{},o=r?"HEAD":"GET",i=!1,a=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join("");return this.url.searchParams.set("select",a),n&&this.headers.append("Prefer",`count=${n}`),new I.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;let o="POST";if(t&&this.headers.append("Prefer",`count=${t}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let i=e.reduce((a,c)=>a.concat(Object.keys(c)),[]);if(i.length>0){let a=[...new Set(i)].map(c=>`"${c}"`);this.url.searchParams.set("columns",a.join(","))}}return new I.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:o=!0}={}){var i;let a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&this.url.searchParams.set("on_conflict",t),n&&this.headers.append("Prefer",`count=${n}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let c=e.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(c.length>0){let l=[...new Set(c)].map(u=>`"${u}"`);this.url.searchParams.set("columns",l.join(","))}}return new I.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(e,{count:t}={}){var r;let n="PATCH";return t&&this.headers.append("Prefer",`count=${t}`),new I.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:e}={}){var t;let r="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new I.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}};oe.default=ne});var We=_(le=>{"use strict";h();Object.defineProperty(le,"__esModule",{value:!0});var Je=(O(),E(x)),_t=Je.__importDefault(ie()),Et=Je.__importDefault(q()),ae=class s{constructor(e,{headers:t={},schema:r,fetch:n}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=n}from(e){let t=new URL(`${this.url}/${e}`);return new _t.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new s(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:n=!1,count:o}={}){var i;let a,c=new URL(`${this.url}/rpc/${e}`),l;r||n?(a=r?"HEAD":"GET",Object.entries(t).filter(([d,m])=>m!==void 0).map(([d,m])=>[d,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([d,m])=>{c.searchParams.append(d,m)})):(a="POST",l=t);let u=new Headers(this.headers);return o&&u.set("Prefer",`count=${o}`),new Et.default({method:a,url:c,headers:u,schema:this.schemaName,body:l,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}};le.default=ae});var et=_(w=>{"use strict";h();Object.defineProperty(w,"__esModule",{value:!0});w.PostgrestError=w.PostgrestBuilder=w.PostgrestTransformBuilder=w.PostgrestFilterBuilder=w.PostgrestQueryBuilder=w.PostgrestClient=void 0;var R=(O(),E(x)),Ve=R.__importDefault(We());w.PostgrestClient=Ve.default;var Ye=R.__importDefault(ie());w.PostgrestQueryBuilder=Ye.default;var Qe=R.__importDefault(q());w.PostgrestFilterBuilder=Qe.default;var Ke=R.__importDefault(te());w.PostgrestTransformBuilder=Ke.default;var Xe=R.__importDefault(X());w.PostgrestBuilder=Xe.default;var Ze=R.__importDefault(Y());w.PostgrestError=Ze.default;w.default={PostgrestClient:Ve.default,PostgrestQueryBuilder:Ye.default,PostgrestFilterBuilder:Qe.default,PostgrestTransformBuilder:Ke.default,PostgrestBuilder:Xe.default,PostgrestError:Ze.default}});var $t={};fe($t,{AbortController:()=>A,AbortSignal:()=>$,ENTITIES_BASE_PATH:()=>rt,FILE_STORAGE_BASE_PATH:()=>ge,GENERATE_UPLOAD_URL_PATH:()=>ve,Headers:()=>v,NvwaEdgeFunctions:()=>D,NvwaFileStorage:()=>F,NvwaHttpClient:()=>B,NvwaSkill:()=>he,OverlayManager:()=>ue,PaymentClient:()=>de,Request:()=>H,Response:()=>C,URL:()=>j,URLSearchParams:()=>S,createPostgrestClient:()=>xt,getSourceLocationFromDOM:()=>Ot,polyfill:()=>ht});module.exports=E($t);h();h();var D=class{constructor(e){this.http=e}async invoke(e,t){return await(await this.http.fetch("/functions/"+e,{method:t.method||"POST",body:t.body,headers:t.headers})).json()}};h();h();var ye="nvwa_current_jwt";h();h();var v=class s{constructor(e){this.headerMap=new Map;if(e){if(e instanceof s)e.forEach((t,r)=>this.set(r,t));else if(Array.isArray(e))for(let[t,r]of e)this.set(t,String(r));else if(typeof e=="object")for(let t of Object.keys(e))this.set(t,String(e[t]))}}append(e,t){let r=e.toLowerCase(),n=this.headerMap.get(r);this.headerMap.set(r,n?`${n}, ${t}`:t)}set(e,t){this.headerMap.set(e.toLowerCase(),String(t))}get(e){let t=this.headerMap.get(e.toLowerCase());return t??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[t,r]of this.headerMap.entries())e(r,t,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},S=class s{constructor(e){this.params=new Map;if(e){if(typeof e=="string")this.parseString(e);else if(e instanceof s)this.params=new Map(e.params);else if(Array.isArray(e))for(let[t,r]of e)this.append(t,r);else if(e&&typeof e=="object")for(let[t,r]of Object.entries(e))this.set(t,r)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let t=e.split("&");for(let r of t)if(r){let[n,o]=r.split("=");n&&this.append(decodeURIComponent(n),o?decodeURIComponent(o):"")}}append(e,t){let r=this.params.get(e)||[];r.push(t),this.params.set(e,r)}delete(e){this.params.delete(e)}get(e){let t=this.params.get(e);return t?t[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,t){this.params.set(e,[t])}sort(){let e=Array.from(this.params.entries()).sort(([t],[r])=>t.localeCompare(r));this.params=new Map(e)}toString(){let e=[];for(let[t,r]of this.params.entries())for(let n of r)e.push(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`);return e.join("&")}forEach(e){for(let[t,r]of this.params.entries())for(let n of r)e(n,t,this)}keys(){return this.params.keys()}values(){let e=[];for(let t of this.params.values())e.push(...t);return e[Symbol.iterator]()}entries(){let e=[];for(let[t,r]of this.params.entries())for(let n of r)e.push([t,n]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},j=class s{constructor(e,t){let r;if(e instanceof s)r=e.href;else if(t){let o=t instanceof s?t.href:t;r=this.resolve(o,e)}else r=e;let n=this.parseUrl(r);this.href=r,this.origin=`${n.protocol}//${n.host}`,this.protocol=n.protocol,this.username=n.username,this.password=n.password,this.host=n.host,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.searchParams=new S(n.search),this.hash=n.hash}resolve(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(t.startsWith("//"))return`${this.parseUrl(e).protocol}${t}`;if(t.startsWith("/")){let o=this.parseUrl(e);return`${o.protocol}//${o.host}${t}`}let r=this.parseUrl(e),n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return`${r.protocol}//${r.host}${n}${t}`}parseUrl(e){let t=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)throw new TypeError("Invalid URL");let r=t[2]||"",n=t[4]||"",o=t[5]||"/",i=t[7]?`?${t[7]}`:"",a=t[9]?`#${t[9]}`:"";if(!r&&!n&&!o.startsWith("/")&&!o.includes("/")&&!o.includes("."))throw new TypeError("Invalid URL");let c=n.match(/^([^@]*)@(.+)$/),l="",u="",d=n;if(c){let b=c[1];d=c[2];let g=b.match(/^([^:]*):?(.*)$/);g&&(l=g[1]||"",u=g[2]||"")}let m=d.match(/^([^:]+):?(\d*)$/),p=m?m[1]:d,y=m&&m[2]?m[2]:"";return{protocol:r?`${r}:`:"",username:l,password:u,host:d,hostname:p,port:y,pathname:o,search:i,hash:a}}toString(){let e=this.searchParams.toString(),t=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${t}${this.hash}`}toJSON(){return this.toString()}};h();var H=class s{constructor(e,t){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(t?.method||"GET").toUpperCase(),this.headers=t?.headers instanceof v?t.headers:new v(t?.headers),this.body=t?.body,this.timeout=t?.timeout,this.signal=t?.signal||void 0}clone(){return new s(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};h();var C=class{constructor(e,t){this.bodyData=e,this.status=t?.status??200,this.statusText=t?.statusText??"",this.headers=ct(t?.headers),this.ok=this.status>=200&&this.status<300}async text(){return typeof this.bodyData=="string"?this.bodyData:this.bodyData==null?"":typeof this.bodyData=="object"?JSON.stringify(this.bodyData):String(this.bodyData)}async json(){if(typeof this.bodyData=="string")try{return JSON.parse(this.bodyData)}catch{}return this.bodyData}async arrayBuffer(){let e=await this.text();return new TextEncoder().encode(e).buffer}};function ct(s){return s?new v(s):new v}h();var $=class{constructor(){this._aborted=!1;this.listeners=new Set;this.onabort=null}get aborted(){return this._aborted}_trigger(){if(!this._aborted){if(this._aborted=!0,typeof this.onabort=="function")try{this.onabort()}catch{}for(let e of Array.from(this.listeners))try{e()}catch{}this.listeners.clear()}}addEventListener(e,t){if(this._aborted){try{t()}catch{}return}this.listeners.add(t)}removeEventListener(e,t){this.listeners.delete(t)}toString(){return"[object AbortSignal]"}},A=class{constructor(){this._signal=new $}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};h();function ht(s){s.URL=j,s.URLSearchParams=S,s.Headers=v,s.Request=H,s.Response=C,s.AbortController=A,s.AbortSignal=$}var B=class{constructor(e,t,r){console.log("NvwaHttpClient constructor",e,t,r),this.storage=e,this.customFetch=t,this.handleUnauthorized=r}async fetch(e,t){return await this.customFetch(e,t)}async fetchWithAuth(e,t){let r=await this.storage.get(ye),n=new v(t?.headers);r&&n.set("Authorization",`Bearer ${r}`);let o=t?.method||"GET";if((o==="POST"||o==="PUT"||o==="PATCH")&&t?.body){let a=n.get("Content-Type");(!a||a.includes("text/plain"))&&n.set("Content-Type","application/json")}let i=await this.customFetch(e,{...t,headers:n});if(i.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return i}};h();var ge="/storage",ve=ge+"/generateUploadUrl",F=class{constructor(e,t){this.baseUrl=e,this.http=t}async uploadFile(e){let t=await this.http.fetch(this.baseUrl+ve,{method:"POST",body:{fileName:e.name||e.fileName,fileSize:e.size||e.fileSize,fileType:e.type||e.fileType}}),{url:r}=await t.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let n=await this.http.fetch(r,{method:"PUT",body:e,headers:new v({"Content-Type":e.type||e.fileType||"application/octet-stream"})}),{url:o}=await n.json();return{url:o.split("?")[0]}}};h();h();h();var ce=lt(et(),1),{PostgrestClient:tt,PostgrestQueryBuilder:Cr,PostgrestFilterBuilder:Ar,PostgrestTransformBuilder:Ir,PostgrestBuilder:Ur,PostgrestError:Lr}=ce.default||ce;var rt="/entities",xt=(s,e)=>new tt(s+rt,{fetch:e.fetchWithAuth.bind(e)});h();var he=class{constructor(e,t){this.baseUrl=e,this.http=t}async execute(e,t){let r=`${this.baseUrl}/skill/${e}/execute`,o=await(await this.http.fetchWithAuth(r,{method:"POST",body:t?JSON.stringify(t):void 0,timeout:6e5})).json();if(o.status!==200)throw new Error(o.message);return o.data}};h();var ue=class{constructor(){this.hoverOverlay=null;this.selectedOverlay=null;this.tooltip=null;this.hoverElement=null;this.selectedElement=null;this.hoverUpdateHandler=null;this.selectedUpdateHandler=null;this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let e=document.createElement("style");e.id="__nvwa-inspector-overlay-style",e.textContent=`
1
+ "use strict";var st=Object.create;var L=Object.defineProperty;var nt=Object.getOwnPropertyDescriptor;var ot=Object.getOwnPropertyNames;var it=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var pe=(s,e)=>()=>(s&&(e=s(s=0)),e);var _=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),fe=(s,e)=>{for(var t in e)L(s,t,{get:e[t],enumerable:!0})},me=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ot(e))!at.call(s,n)&&n!==t&&L(s,n,{get:()=>e[n],enumerable:!(r=nt(e,n))||r.enumerable});return s};var lt=(s,e,t)=>(t=s!=null?st(it(s)):{},me(e||!s||!s.__esModule?L(t,"default",{value:s,enumerable:!0}):t,s)),E=s=>me(L({},"__esModule",{value:!0}),s);var h=pe(()=>{"use strict"});var x={};fe(x,{__addDisposableResource:()=>Fe,__assign:()=>N,__asyncDelegator:()=>Ie,__asyncGenerator:()=>Ae,__asyncValues:()=>Le,__await:()=>T,__awaiter:()=>Te,__classPrivateFieldGet:()=>qe,__classPrivateFieldIn:()=>Be,__classPrivateFieldSet:()=>De,__createBinding:()=>M,__decorate:()=>Pe,__disposeResources:()=>ze,__esDecorate:()=>Ee,__exportStar:()=>je,__extends:()=>we,__generator:()=>Re,__importDefault:()=>Me,__importStar:()=>ke,__makeTemplateObject:()=>Ne,__metadata:()=>$e,__param:()=>_e,__propKey:()=>Oe,__read:()=>J,__rest:()=>be,__rewriteRelativeImportExtension:()=>Ge,__runInitializers:()=>xe,__setFunctionName:()=>Se,__spread:()=>He,__spreadArray:()=>Ue,__spreadArrays:()=>Ce,__values:()=>k,default:()=>pt});function we(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");z(s,e);function t(){this.constructor=s}s.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function be(s,e){var t={};for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&e.indexOf(r)<0&&(t[r]=s[r]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(s);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(s,r[n])&&(t[r[n]]=s[r[n]]);return t}function Pe(s,e,t,r){var n=arguments.length,o=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,r);else for(var a=s.length-1;a>=0;a--)(i=s[a])&&(o=(n<3?i(o):n>3?i(e,t,o):i(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o}function _e(s,e){return function(t,r){e(t,r,s)}}function Ee(s,e,t,r,n,o){function i(P){if(P!==void 0&&typeof P!="function")throw new TypeError("Function expected");return P}for(var a=r.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!e&&s?r.static?s:s.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,m=!1,p=t.length-1;p>=0;p--){var y={};for(var b in r)y[b]=b==="access"?{}:r[b];for(var b in r.access)y.access[b]=r.access[b];y.addInitializer=function(P){if(m)throw new TypeError("Cannot add initializers after decoration has completed");o.push(i(P||null))};var g=(0,t[p])(a==="accessor"?{get:u.get,set:u.set}:u[c],y);if(a==="accessor"){if(g===void 0)continue;if(g===null||typeof g!="object")throw new TypeError("Object expected");(d=i(g.get))&&(u.get=d),(d=i(g.set))&&(u.set=d),(d=i(g.init))&&n.unshift(d)}else(d=i(g))&&(a==="field"?n.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),m=!0}function xe(s,e,t){for(var r=arguments.length>2,n=0;n<e.length;n++)t=r?e[n].call(s,t):e[n].call(s);return r?t:void 0}function Oe(s){return typeof s=="symbol"?s:"".concat(s)}function Se(s,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(s,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function $e(s,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,e)}function Te(s,e,t,r){function n(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{l(r.next(u))}catch(d){i(d)}}function c(u){try{l(r.throw(u))}catch(d){i(d)}}function l(u){u.done?o(u.value):n(u.value).then(a,c)}l((r=r.apply(s,e||[])).next())})}function Re(s,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(t=0)),t;)try{if(r=1,n&&(o=l[0]&2?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,n=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){t.label=l[1];break}if(l[0]===6&&t.label<o[1]){t.label=o[1],o=l;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(l);break}o[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(s,t)}catch(u){l=[6,u],n=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function je(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&M(e,s,t)}function k(s){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&s[e],r=0;if(t)return t.call(s);if(s&&typeof s.length=="number")return{next:function(){return s&&r>=s.length&&(s=void 0),{value:s&&s[r++],done:!s}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function J(s,e){var t=typeof Symbol=="function"&&s[Symbol.iterator];if(!t)return s;var r=t.call(s),n,o=[],i;try{for(;(e===void 0||e-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(a){i={error:a}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o}function He(){for(var s=[],e=0;e<arguments.length;e++)s=s.concat(J(arguments[e]));return s}function Ce(){for(var s=0,e=0,t=arguments.length;e<t;e++)s+=arguments[e].length;for(var r=Array(s),n=0,e=0;e<t;e++)for(var o=arguments[e],i=0,a=o.length;i<a;i++,n++)r[n]=o[i];return r}function Ue(s,e,t){if(t||arguments.length===2)for(var r=0,n=e.length,o;r<n;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return s.concat(o||Array.prototype.slice.call(e))}function T(s){return this instanceof T?(this.v=s,this):new T(s)}function Ae(s,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(s,e||[]),n,o=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),n[Symbol.asyncIterator]=function(){return this},n;function i(p){return function(y){return Promise.resolve(y).then(p,d)}}function a(p,y){r[p]&&(n[p]=function(b){return new Promise(function(g,P){o.push([p,b,g,P])>1||c(p,b)})},y&&(n[p]=y(n[p])))}function c(p,y){try{l(r[p](y))}catch(b){m(o[0][3],b)}}function l(p){p.value instanceof T?Promise.resolve(p.value.v).then(u,d):m(o[0][2],p)}function u(p){c("next",p)}function d(p){c("throw",p)}function m(p,y){p(y),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Ie(s){var e,t;return e={},r("next"),r("throw",function(n){throw n}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(n,o){e[n]=s[n]?function(i){return(t=!t)?{value:T(s[n](i)),done:!1}:o?o(i):i}:o}}function Le(s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=s[Symbol.asyncIterator],t;return e?e.call(s):(s=typeof k=="function"?k(s):s[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=s[o]&&function(i){return new Promise(function(a,c){i=s[o](i),n(a,c,i.done,i.value)})}}function n(o,i,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},i)}}function Ne(s,e){return Object.defineProperty?Object.defineProperty(s,"raw",{value:e}):s.raw=e,s}function ke(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t=G(s),r=0;r<t.length;r++)t[r]!=="default"&&M(e,s,t[r]);return ut(e,s),e}function Me(s){return s&&s.__esModule?s:{default:s}}function qe(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)}function De(s,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(s,t):n?n.value=t:e.set(s,t),t}function Be(s,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof s=="function"?e===s:s.has(e)}function Fe(s,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,n;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],t&&(n=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");n&&(r=function(){try{n.call(this)}catch(o){return Promise.reject(o)}}),s.stack.push({value:e,dispose:r,async:t})}else t&&s.stack.push({async:!0});return e}function ze(s){function e(o){s.error=s.hasError?new dt(o,s.error,"An error was suppressed during disposal."):o,s.hasError=!0}var t,r=0;function n(){for(;t=s.stack.pop();)try{if(!t.async&&r===1)return r=0,s.stack.push(t),Promise.resolve().then(n);if(t.dispose){var o=t.dispose.call(t.value);if(t.async)return r|=2,Promise.resolve(o).then(n,function(i){return e(i),n()})}else r|=1}catch(i){e(i)}if(r===1)return s.hasError?Promise.reject(s.error):Promise.resolve();if(s.hasError)throw s.error}return n()}function Ge(s,e){return typeof s=="string"&&/^\.\.?\//.test(s)?s.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,n,o,i){return r?e?".jsx":".js":n&&(!o||!i)?t:n+o+"."+i.toLowerCase()+"js"}):s}var z,N,M,ut,G,dt,pt,O=pe(()=>{"use strict";h();z=function(s,e){return z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},z(s,e)};N=function(){return N=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},N.apply(this,arguments)};M=Object.create?(function(s,e,t,r){r===void 0&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,n)}):(function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]});ut=Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e},G=function(s){return G=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},G(s)};dt=typeof SuppressedError=="function"?SuppressedError:function(s,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=s,r.suppressed=e,r};pt={__extends:we,__assign:N,__rest:be,__decorate:Pe,__param:_e,__esDecorate:Ee,__runInitializers:xe,__propKey:Oe,__setFunctionName:Se,__metadata:$e,__awaiter:Te,__generator:Re,__createBinding:M,__exportStar:je,__values:k,__read:J,__spread:He,__spreadArrays:Ce,__spreadArray:Ue,__await:T,__asyncGenerator:Ae,__asyncDelegator:Ie,__asyncValues:Le,__makeTemplateObject:Ne,__importStar:ke,__importDefault:Me,__classPrivateFieldGet:qe,__classPrivateFieldSet:De,__classPrivateFieldIn:Be,__addDisposableResource:Fe,__disposeResources:ze,__rewriteRelativeImportExtension:Ge}});var Y=_(V=>{"use strict";h();Object.defineProperty(V,"__esModule",{value:!0});var W=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};V.default=W});var X=_(K=>{"use strict";h();Object.defineProperty(K,"__esModule",{value:!0});var ft=(O(),E(x)),mt=ft.__importDefault(Y()),Q=class{constructor(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let r=this.fetch,n=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{var i,a,c,l;let u=null,d=null,m=null,p=o.status,y=o.statusText;if(o.ok){if(this.method!=="HEAD"){let I=await o.text();I===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text"))?d=I:d=JSON.parse(I))}let g=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),P=(c=o.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");g&&P&&P.length>1&&(m=parseInt(P[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,m=null,p=406,y="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let g=await o.text();try{u=JSON.parse(g),Array.isArray(u)&&o.status===404&&(d=[],u=null,p=200,y="OK")}catch{o.status===404&&g===""?(p=204,y="No Content"):u={message:g}}if(u&&this.isMaybeSingle&&(!((l=u?.details)===null||l===void 0)&&l.includes("0 rows"))&&(u=null,p=200,y="OK"),u&&this.shouldThrowOnError)throw new mt.default(u)}return{error:u,data:d,count:m,status:p,statusText:y}});return this.shouldThrowOnError||(n=n.catch(o=>{var i,a,c;return{error:{message:`${(i=o?.name)!==null&&i!==void 0?i:"FetchError"}: ${o?.message}`,details:`${(a=o?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(c=o?.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),n.then(e,t)}returns(){return this}overrideTypes(){return this}};K.default=Q});var te=_(ee=>{"use strict";h();Object.defineProperty(ee,"__esModule",{value:!0});var yt=(O(),E(x)),gt=yt.__importDefault(X()),Z=class extends gt.default{select(e){let t=!1,r=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:o=n}={}){let i=o?`${o}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){let o=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(o,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:o=!1,format:i="text"}={}){var a;let c=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,o?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${c};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};ee.default=Z});var q=_(se=>{"use strict";h();Object.defineProperty(se,"__esModule",{value:!0});var vt=(O(),E(x)),wt=vt.__importDefault(te()),bt=new RegExp("[,()]"),re=class extends wt.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(n=>typeof n=="string"&&bt.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let o="";n==="plain"?o="pl":n==="phrase"?o="ph":n==="websearch"&&(o="w");let i=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${o}fts${i}.${t}`),this}match(e){return Object.entries(e).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}};se.default=re});var ie=_(oe=>{"use strict";h();Object.defineProperty(oe,"__esModule",{value:!0});var Pt=(O(),E(x)),A=Pt.__importDefault(q()),ne=class{constructor(e,{headers:t={},schema:r,fetch:n}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n}select(e,t){let{head:r=!1,count:n}=t??{},o=r?"HEAD":"GET",i=!1,a=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join("");return this.url.searchParams.set("select",a),n&&this.headers.append("Prefer",`count=${n}`),new A.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;let o="POST";if(t&&this.headers.append("Prefer",`count=${t}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let i=e.reduce((a,c)=>a.concat(Object.keys(c)),[]);if(i.length>0){let a=[...new Set(i)].map(c=>`"${c}"`);this.url.searchParams.set("columns",a.join(","))}}return new A.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:o=!0}={}){var i;let a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&this.url.searchParams.set("on_conflict",t),n&&this.headers.append("Prefer",`count=${n}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let c=e.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(c.length>0){let l=[...new Set(c)].map(u=>`"${u}"`);this.url.searchParams.set("columns",l.join(","))}}return new A.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(e,{count:t}={}){var r;let n="PATCH";return t&&this.headers.append("Prefer",`count=${t}`),new A.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:e}={}){var t;let r="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new A.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}};oe.default=ne});var We=_(le=>{"use strict";h();Object.defineProperty(le,"__esModule",{value:!0});var Je=(O(),E(x)),_t=Je.__importDefault(ie()),Et=Je.__importDefault(q()),ae=class s{constructor(e,{headers:t={},schema:r,fetch:n}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=n}from(e){let t=new URL(`${this.url}/${e}`);return new _t.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new s(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:n=!1,count:o}={}){var i;let a,c=new URL(`${this.url}/rpc/${e}`),l;r||n?(a=r?"HEAD":"GET",Object.entries(t).filter(([d,m])=>m!==void 0).map(([d,m])=>[d,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([d,m])=>{c.searchParams.append(d,m)})):(a="POST",l=t);let u=new Headers(this.headers);return o&&u.set("Prefer",`count=${o}`),new Et.default({method:a,url:c,headers:u,schema:this.schemaName,body:l,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}};le.default=ae});var et=_(w=>{"use strict";h();Object.defineProperty(w,"__esModule",{value:!0});w.PostgrestError=w.PostgrestBuilder=w.PostgrestTransformBuilder=w.PostgrestFilterBuilder=w.PostgrestQueryBuilder=w.PostgrestClient=void 0;var R=(O(),E(x)),Ve=R.__importDefault(We());w.PostgrestClient=Ve.default;var Ye=R.__importDefault(ie());w.PostgrestQueryBuilder=Ye.default;var Qe=R.__importDefault(q());w.PostgrestFilterBuilder=Qe.default;var Ke=R.__importDefault(te());w.PostgrestTransformBuilder=Ke.default;var Xe=R.__importDefault(X());w.PostgrestBuilder=Xe.default;var Ze=R.__importDefault(Y());w.PostgrestError=Ze.default;w.default={PostgrestClient:Ve.default,PostgrestQueryBuilder:Ye.default,PostgrestFilterBuilder:Qe.default,PostgrestTransformBuilder:Ke.default,PostgrestBuilder:Xe.default,PostgrestError:Ze.default}});var $t={};fe($t,{AbortController:()=>U,AbortSignal:()=>$,ENTITIES_BASE_PATH:()=>rt,FILE_STORAGE_BASE_PATH:()=>ge,GENERATE_UPLOAD_URL_PATH:()=>ve,Headers:()=>v,NvwaEdgeFunctions:()=>D,NvwaFileStorage:()=>F,NvwaHttpClient:()=>B,NvwaSkill:()=>he,OverlayManager:()=>ue,PaymentClient:()=>de,Request:()=>H,Response:()=>C,URL:()=>j,URLSearchParams:()=>S,createPostgrestClient:()=>xt,getSourceLocationFromDOM:()=>Ot,polyfill:()=>ht});module.exports=E($t);h();h();var D=class{constructor(e,t=""){this.http=e,this.baseUrl=t.replace(/\/$/,"")}async invoke(e,t){let r=this.baseUrl?`${this.baseUrl}/functions/${e}`:`/functions/${e}`;return await(await this.http.fetch(r,{method:t.method||"POST",body:t.body,headers:t.headers})).json()}};h();h();var ye="nvwa_current_jwt";h();h();var v=class s{constructor(e){this.headerMap=new Map;if(e){if(e instanceof s)e.forEach((t,r)=>this.set(r,t));else if(Array.isArray(e))for(let[t,r]of e)this.set(t,String(r));else if(typeof e=="object")for(let t of Object.keys(e))this.set(t,String(e[t]))}}append(e,t){let r=e.toLowerCase(),n=this.headerMap.get(r);this.headerMap.set(r,n?`${n}, ${t}`:t)}set(e,t){this.headerMap.set(e.toLowerCase(),String(t))}get(e){let t=this.headerMap.get(e.toLowerCase());return t??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[t,r]of this.headerMap.entries())e(r,t,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},S=class s{constructor(e){this.params=new Map;if(e){if(typeof e=="string")this.parseString(e);else if(e instanceof s)this.params=new Map(e.params);else if(Array.isArray(e))for(let[t,r]of e)this.append(t,r);else if(e&&typeof e=="object")for(let[t,r]of Object.entries(e))this.set(t,r)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let t=e.split("&");for(let r of t)if(r){let[n,o]=r.split("=");n&&this.append(decodeURIComponent(n),o?decodeURIComponent(o):"")}}append(e,t){let r=this.params.get(e)||[];r.push(t),this.params.set(e,r)}delete(e){this.params.delete(e)}get(e){let t=this.params.get(e);return t?t[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,t){this.params.set(e,[t])}sort(){let e=Array.from(this.params.entries()).sort(([t],[r])=>t.localeCompare(r));this.params=new Map(e)}toString(){let e=[];for(let[t,r]of this.params.entries())for(let n of r)e.push(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`);return e.join("&")}forEach(e){for(let[t,r]of this.params.entries())for(let n of r)e(n,t,this)}keys(){return this.params.keys()}values(){let e=[];for(let t of this.params.values())e.push(...t);return e[Symbol.iterator]()}entries(){let e=[];for(let[t,r]of this.params.entries())for(let n of r)e.push([t,n]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},j=class s{constructor(e,t){let r;if(e instanceof s)r=e.href;else if(t){let o=t instanceof s?t.href:t;r=this.resolve(o,e)}else r=e;let n=this.parseUrl(r);this.href=r,this.origin=`${n.protocol}//${n.host}`,this.protocol=n.protocol,this.username=n.username,this.password=n.password,this.host=n.host,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.searchParams=new S(n.search),this.hash=n.hash}resolve(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(t.startsWith("//"))return`${this.parseUrl(e).protocol}${t}`;if(t.startsWith("/")){let o=this.parseUrl(e);return`${o.protocol}//${o.host}${t}`}let r=this.parseUrl(e),n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return`${r.protocol}//${r.host}${n}${t}`}parseUrl(e){let t=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)throw new TypeError("Invalid URL");let r=t[2]||"",n=t[4]||"",o=t[5]||"/",i=t[7]?`?${t[7]}`:"",a=t[9]?`#${t[9]}`:"";if(!r&&!n&&!o.startsWith("/")&&!o.includes("/")&&!o.includes("."))throw new TypeError("Invalid URL");let c=n.match(/^([^@]*)@(.+)$/),l="",u="",d=n;if(c){let b=c[1];d=c[2];let g=b.match(/^([^:]*):?(.*)$/);g&&(l=g[1]||"",u=g[2]||"")}let m=d.match(/^([^:]+):?(\d*)$/),p=m?m[1]:d,y=m&&m[2]?m[2]:"";return{protocol:r?`${r}:`:"",username:l,password:u,host:d,hostname:p,port:y,pathname:o,search:i,hash:a}}toString(){let e=this.searchParams.toString(),t=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${t}${this.hash}`}toJSON(){return this.toString()}};h();var H=class s{constructor(e,t){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(t?.method||"GET").toUpperCase(),this.headers=t?.headers instanceof v?t.headers:new v(t?.headers),this.body=t?.body,this.timeout=t?.timeout,this.signal=t?.signal||void 0}clone(){return new s(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};h();var C=class{constructor(e,t){this.bodyData=e,this.status=t?.status??200,this.statusText=t?.statusText??"",this.headers=ct(t?.headers),this.ok=this.status>=200&&this.status<300}async text(){return typeof this.bodyData=="string"?this.bodyData:this.bodyData==null?"":typeof this.bodyData=="object"?JSON.stringify(this.bodyData):String(this.bodyData)}async json(){if(typeof this.bodyData=="string")try{return JSON.parse(this.bodyData)}catch{}return this.bodyData}async arrayBuffer(){let e=await this.text();return new TextEncoder().encode(e).buffer}};function ct(s){return s?new v(s):new v}h();var $=class{constructor(){this._aborted=!1;this.listeners=new Set;this.onabort=null}get aborted(){return this._aborted}_trigger(){if(!this._aborted){if(this._aborted=!0,typeof this.onabort=="function")try{this.onabort()}catch{}for(let e of Array.from(this.listeners))try{e()}catch{}this.listeners.clear()}}addEventListener(e,t){if(this._aborted){try{t()}catch{}return}this.listeners.add(t)}removeEventListener(e,t){this.listeners.delete(t)}toString(){return"[object AbortSignal]"}},U=class{constructor(){this._signal=new $}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};h();function ht(s){s.URL=j,s.URLSearchParams=S,s.Headers=v,s.Request=H,s.Response=C,s.AbortController=U,s.AbortSignal=$}var B=class{constructor(e,t,r){console.log("NvwaHttpClient constructor",e,t,r),this.storage=e,this.customFetch=t,this.handleUnauthorized=r}async fetch(e,t){return await this.customFetch(e,t)}async fetchWithAuth(e,t){let r=await this.storage.get(ye),n=new v(t?.headers);r&&n.set("Authorization",`Bearer ${r}`);let o=t?.method||"GET";if((o==="POST"||o==="PUT"||o==="PATCH")&&t?.body){let a=n.get("Content-Type");(!a||a.includes("text/plain"))&&n.set("Content-Type","application/json")}let i=await this.customFetch(e,{...t,headers:n});if(i.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return i}};h();var ge="/storage",ve=ge+"/generateUploadUrl",F=class{constructor(e,t){this.baseUrl=e,this.http=t}async uploadFile(e){let t=await this.http.fetch(this.baseUrl+ve,{method:"POST",body:{fileName:e.name||e.fileName,fileSize:e.size||e.fileSize,fileType:e.type||e.fileType}}),{url:r}=await t.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let n=await this.http.fetch(r,{method:"PUT",body:e,headers:new v({"Content-Type":e.type||e.fileType||"application/octet-stream"})}),{url:o}=await n.json();return{url:o.split("?")[0]}}};h();h();h();var ce=lt(et(),1),{PostgrestClient:tt,PostgrestQueryBuilder:Cr,PostgrestFilterBuilder:Ur,PostgrestTransformBuilder:Ar,PostgrestBuilder:Ir,PostgrestError:Lr}=ce.default||ce;var rt="/entities",xt=(s,e)=>new tt(s+rt,{fetch:e.fetchWithAuth.bind(e)});h();var he=class{constructor(e,t){this.baseUrl=e,this.http=t}async execute(e,t){let r=`${this.baseUrl}/skill/${e}/execute`,o=await(await this.http.fetchWithAuth(r,{method:"POST",body:t?JSON.stringify(t):void 0,timeout:6e5})).json();if(o.status!==200)throw new Error(o.message);return o.data}};h();var ue=class{constructor(){this.hoverOverlay=null;this.selectedOverlay=null;this.tooltip=null;this.hoverElement=null;this.selectedElement=null;this.hoverUpdateHandler=null;this.selectedUpdateHandler=null;this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let e=document.createElement("style");e.id="__nvwa-inspector-overlay-style",e.textContent=`
2
2
  .__nvwa-inspector-overlay {
3
3
  position: absolute;
4
4
  pointer-events: none;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var et=Object.create;var A=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var st=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var le=(s,e)=>()=>(s&&(e=s(s=0)),e);var E=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),ot=(s,e)=>{for(var t in e)A(s,t,{get:e[t],enumerable:!0})},ce=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of rt(e))!nt.call(s,n)&&n!==t&&A(s,n,{get:()=>e[n],enumerable:!(r=tt(e,n))||r.enumerable});return s};var it=(s,e,t)=>(t=s!=null?et(st(s)):{},ce(e||!s||!s.__esModule?A(t,"default",{value:s,enumerable:!0}):t,s)),S=s=>ce(A({},"__esModule",{value:!0}),s);import $t from"path";import{fileURLToPath as Rt}from"url";var h=le(()=>{"use strict"});var x={};ot(x,{__addDisposableResource:()=>ke,__assign:()=>k,__asyncDelegator:()=>je,__asyncGenerator:()=>Re,__asyncValues:()=>He,__await:()=>$,__awaiter:()=>Ee,__classPrivateFieldGet:()=>Ue,__classPrivateFieldIn:()=>Ne,__classPrivateFieldSet:()=>Le,__createBinding:()=>q,__decorate:()=>ye,__disposeResources:()=>Me,__esDecorate:()=>ve,__exportStar:()=>Oe,__extends:()=>fe,__generator:()=>xe,__importDefault:()=>Ie,__importStar:()=>Ae,__makeTemplateObject:()=>Ce,__metadata:()=>_e,__param:()=>ge,__propKey:()=>be,__read:()=>z,__rest:()=>me,__rewriteRelativeImportExtension:()=>qe,__runInitializers:()=>we,__setFunctionName:()=>Pe,__spread:()=>Se,__spreadArray:()=>Te,__spreadArrays:()=>$e,__values:()=>M,default:()=>dt});function fe(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");B(s,e);function t(){this.constructor=s}s.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function me(s,e){var t={};for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&e.indexOf(r)<0&&(t[r]=s[r]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(s);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(s,r[n])&&(t[r[n]]=s[r[n]]);return t}function ye(s,e,t,r){var n=arguments.length,o=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,r);else for(var a=s.length-1;a>=0;a--)(i=s[a])&&(o=(n<3?i(o):n>3?i(e,t,o):i(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o}function ge(s,e){return function(t,r){e(t,r,s)}}function ve(s,e,t,r,n,o){function i(_){if(_!==void 0&&typeof _!="function")throw new TypeError("Function expected");return _}for(var a=r.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!e&&s?r.static?s:s.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,y=!1,p=t.length-1;p>=0;p--){var g={};for(var b in r)g[b]=b==="access"?{}:r[b];for(var b in r.access)g.access[b]=r.access[b];g.addInitializer=function(_){if(y)throw new TypeError("Cannot add initializers after decoration has completed");o.push(i(_||null))};var v=(0,t[p])(a==="accessor"?{get:u.get,set:u.set}:u[c],g);if(a==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(d=i(v.get))&&(u.get=d),(d=i(v.set))&&(u.set=d),(d=i(v.init))&&n.unshift(d)}else(d=i(v))&&(a==="field"?n.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),y=!0}function we(s,e,t){for(var r=arguments.length>2,n=0;n<e.length;n++)t=r?e[n].call(s,t):e[n].call(s);return r?t:void 0}function be(s){return typeof s=="symbol"?s:"".concat(s)}function Pe(s,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(s,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function _e(s,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,e)}function Ee(s,e,t,r){function n(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{l(r.next(u))}catch(d){i(d)}}function c(u){try{l(r.throw(u))}catch(d){i(d)}}function l(u){u.done?o(u.value):n(u.value).then(a,c)}l((r=r.apply(s,e||[])).next())})}function xe(s,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(t=0)),t;)try{if(r=1,n&&(o=l[0]&2?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,n=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){t.label=l[1];break}if(l[0]===6&&t.label<o[1]){t.label=o[1],o=l;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(l);break}o[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(s,t)}catch(u){l=[6,u],n=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Oe(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&q(e,s,t)}function M(s){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&s[e],r=0;if(t)return t.call(s);if(s&&typeof s.length=="number")return{next:function(){return s&&r>=s.length&&(s=void 0),{value:s&&s[r++],done:!s}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(s,e){var t=typeof Symbol=="function"&&s[Symbol.iterator];if(!t)return s;var r=t.call(s),n,o=[],i;try{for(;(e===void 0||e-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(a){i={error:a}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o}function Se(){for(var s=[],e=0;e<arguments.length;e++)s=s.concat(z(arguments[e]));return s}function $e(){for(var s=0,e=0,t=arguments.length;e<t;e++)s+=arguments[e].length;for(var r=Array(s),n=0,e=0;e<t;e++)for(var o=arguments[e],i=0,a=o.length;i<a;i++,n++)r[n]=o[i];return r}function Te(s,e,t){if(t||arguments.length===2)for(var r=0,n=e.length,o;r<n;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return s.concat(o||Array.prototype.slice.call(e))}function $(s){return this instanceof $?(this.v=s,this):new $(s)}function Re(s,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(s,e||[]),n,o=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),n[Symbol.asyncIterator]=function(){return this},n;function i(p){return function(g){return Promise.resolve(g).then(p,d)}}function a(p,g){r[p]&&(n[p]=function(b){return new Promise(function(v,_){o.push([p,b,v,_])>1||c(p,b)})},g&&(n[p]=g(n[p])))}function c(p,g){try{l(r[p](g))}catch(b){y(o[0][3],b)}}function l(p){p.value instanceof $?Promise.resolve(p.value.v).then(u,d):y(o[0][2],p)}function u(p){c("next",p)}function d(p){c("throw",p)}function y(p,g){p(g),o.shift(),o.length&&c(o[0][0],o[0][1])}}function je(s){var e,t;return e={},r("next"),r("throw",function(n){throw n}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(n,o){e[n]=s[n]?function(i){return(t=!t)?{value:$(s[n](i)),done:!1}:o?o(i):i}:o}}function He(s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=s[Symbol.asyncIterator],t;return e?e.call(s):(s=typeof M=="function"?M(s):s[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=s[o]&&function(i){return new Promise(function(a,c){i=s[o](i),n(a,c,i.done,i.value)})}}function n(o,i,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},i)}}function Ce(s,e){return Object.defineProperty?Object.defineProperty(s,"raw",{value:e}):s.raw=e,s}function Ae(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t=F(s),r=0;r<t.length;r++)t[r]!=="default"&&q(e,s,t[r]);return ht(e,s),e}function Ie(s){return s&&s.__esModule?s:{default:s}}function Ue(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)}function Le(s,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(s,t):n?n.value=t:e.set(s,t),t}function Ne(s,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof s=="function"?e===s:s.has(e)}function ke(s,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,n;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],t&&(n=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");n&&(r=function(){try{n.call(this)}catch(o){return Promise.reject(o)}}),s.stack.push({value:e,dispose:r,async:t})}else t&&s.stack.push({async:!0});return e}function Me(s){function e(o){s.error=s.hasError?new ut(o,s.error,"An error was suppressed during disposal."):o,s.hasError=!0}var t,r=0;function n(){for(;t=s.stack.pop();)try{if(!t.async&&r===1)return r=0,s.stack.push(t),Promise.resolve().then(n);if(t.dispose){var o=t.dispose.call(t.value);if(t.async)return r|=2,Promise.resolve(o).then(n,function(i){return e(i),n()})}else r|=1}catch(i){e(i)}if(r===1)return s.hasError?Promise.reject(s.error):Promise.resolve();if(s.hasError)throw s.error}return n()}function qe(s,e){return typeof s=="string"&&/^\.\.?\//.test(s)?s.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,n,o,i){return r?e?".jsx":".js":n&&(!o||!i)?t:n+o+"."+i.toLowerCase()+"js"}):s}var B,k,q,ht,F,ut,dt,O=le(()=>{"use strict";h();B=function(s,e){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},B(s,e)};k=function(){return k=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},k.apply(this,arguments)};q=Object.create?(function(s,e,t,r){r===void 0&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,n)}):(function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]});ht=Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e},F=function(s){return F=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},F(s)};ut=typeof SuppressedError=="function"?SuppressedError:function(s,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=s,r.suppressed=e,r};dt={__extends:fe,__assign:k,__rest:me,__decorate:ye,__param:ge,__esDecorate:ve,__runInitializers:we,__propKey:be,__setFunctionName:Pe,__metadata:_e,__awaiter:Ee,__generator:xe,__createBinding:q,__exportStar:Oe,__values:M,__read:z,__spread:Se,__spreadArrays:$e,__spreadArray:Te,__await:$,__asyncGenerator:Re,__asyncDelegator:je,__asyncValues:He,__makeTemplateObject:Ce,__importStar:Ae,__importDefault:Ie,__classPrivateFieldGet:Ue,__classPrivateFieldSet:Le,__classPrivateFieldIn:Ne,__addDisposableResource:ke,__disposeResources:Me,__rewriteRelativeImportExtension:qe}});var W=E(J=>{"use strict";h();Object.defineProperty(J,"__esModule",{value:!0});var G=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};J.default=G});var Q=E(Y=>{"use strict";h();Object.defineProperty(Y,"__esModule",{value:!0});var pt=(O(),S(x)),ft=pt.__importDefault(W()),V=class{constructor(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let r=this.fetch,n=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{var i,a,c,l;let u=null,d=null,y=null,p=o.status,g=o.statusText;if(o.ok){if(this.method!=="HEAD"){let C=await o.text();C===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text"))?d=C:d=JSON.parse(C))}let v=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),_=(c=o.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");v&&_&&_.length>1&&(y=parseInt(_[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,y=null,p=406,g="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let v=await o.text();try{u=JSON.parse(v),Array.isArray(u)&&o.status===404&&(d=[],u=null,p=200,g="OK")}catch{o.status===404&&v===""?(p=204,g="No Content"):u={message:v}}if(u&&this.isMaybeSingle&&(!((l=u?.details)===null||l===void 0)&&l.includes("0 rows"))&&(u=null,p=200,g="OK"),u&&this.shouldThrowOnError)throw new ft.default(u)}return{error:u,data:d,count:y,status:p,statusText:g}});return this.shouldThrowOnError||(n=n.catch(o=>{var i,a,c;return{error:{message:`${(i=o?.name)!==null&&i!==void 0?i:"FetchError"}: ${o?.message}`,details:`${(a=o?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(c=o?.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),n.then(e,t)}returns(){return this}overrideTypes(){return this}};Y.default=V});var Z=E(X=>{"use strict";h();Object.defineProperty(X,"__esModule",{value:!0});var mt=(O(),S(x)),yt=mt.__importDefault(Q()),K=class extends yt.default{select(e){let t=!1,r=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:o=n}={}){let i=o?`${o}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){let o=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(o,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:o=!1,format:i="text"}={}){var a;let c=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,o?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${c};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};X.default=K});var D=E(te=>{"use strict";h();Object.defineProperty(te,"__esModule",{value:!0});var gt=(O(),S(x)),vt=gt.__importDefault(Z()),wt=new RegExp("[,()]"),ee=class extends vt.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(n=>typeof n=="string"&&wt.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let o="";n==="plain"?o="pl":n==="phrase"?o="ph":n==="websearch"&&(o="w");let i=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${o}fts${i}.${t}`),this}match(e){return Object.entries(e).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}};te.default=ee});var ne=E(se=>{"use strict";h();Object.defineProperty(se,"__esModule",{value:!0});var bt=(O(),S(x)),H=bt.__importDefault(D()),re=class{constructor(e,{headers:t={},schema:r,fetch:n}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n}select(e,t){let{head:r=!1,count:n}=t??{},o=r?"HEAD":"GET",i=!1,a=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join("");return this.url.searchParams.set("select",a),n&&this.headers.append("Prefer",`count=${n}`),new H.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;let o="POST";if(t&&this.headers.append("Prefer",`count=${t}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let i=e.reduce((a,c)=>a.concat(Object.keys(c)),[]);if(i.length>0){let a=[...new Set(i)].map(c=>`"${c}"`);this.url.searchParams.set("columns",a.join(","))}}return new H.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:o=!0}={}){var i;let a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&this.url.searchParams.set("on_conflict",t),n&&this.headers.append("Prefer",`count=${n}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let c=e.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(c.length>0){let l=[...new Set(c)].map(u=>`"${u}"`);this.url.searchParams.set("columns",l.join(","))}}return new H.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(e,{count:t}={}){var r;let n="PATCH";return t&&this.headers.append("Prefer",`count=${t}`),new H.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:e}={}){var t;let r="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new H.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}};se.default=re});var Be=E(ie=>{"use strict";h();Object.defineProperty(ie,"__esModule",{value:!0});var De=(O(),S(x)),Pt=De.__importDefault(ne()),_t=De.__importDefault(D()),oe=class s{constructor(e,{headers:t={},schema:r,fetch:n}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=n}from(e){let t=new URL(`${this.url}/${e}`);return new Pt.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new s(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:n=!1,count:o}={}){var i;let a,c=new URL(`${this.url}/rpc/${e}`),l;r||n?(a=r?"HEAD":"GET",Object.entries(t).filter(([d,y])=>y!==void 0).map(([d,y])=>[d,Array.isArray(y)?`{${y.join(",")}}`:`${y}`]).forEach(([d,y])=>{c.searchParams.append(d,y)})):(a="POST",l=t);let u=new Headers(this.headers);return o&&u.set("Prefer",`count=${o}`),new _t.default({method:a,url:c,headers:u,schema:this.schemaName,body:l,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}};ie.default=oe});var Ye=E(w=>{"use strict";h();Object.defineProperty(w,"__esModule",{value:!0});w.PostgrestError=w.PostgrestBuilder=w.PostgrestTransformBuilder=w.PostgrestFilterBuilder=w.PostgrestQueryBuilder=w.PostgrestClient=void 0;var T=(O(),S(x)),Fe=T.__importDefault(Be());w.PostgrestClient=Fe.default;var ze=T.__importDefault(ne());w.PostgrestQueryBuilder=ze.default;var Ge=T.__importDefault(D());w.PostgrestFilterBuilder=Ge.default;var Je=T.__importDefault(Z());w.PostgrestTransformBuilder=Je.default;var We=T.__importDefault(Q());w.PostgrestBuilder=We.default;var Ve=T.__importDefault(W());w.PostgrestError=Ve.default;w.default={PostgrestClient:Fe.default,PostgrestQueryBuilder:ze.default,PostgrestFilterBuilder:Ge.default,PostgrestTransformBuilder:Je.default,PostgrestBuilder:We.default,PostgrestError:Ve.default}});h();h();var he=class{constructor(e){this.http=e}async invoke(e,t){return await(await this.http.fetch("/functions/"+e,{method:t.method||"POST",body:t.body,headers:t.headers})).json()}};h();h();var ue="nvwa_current_jwt";h();h();var P=class s{constructor(e){this.headerMap=new Map;if(e){if(e instanceof s)e.forEach((t,r)=>this.set(r,t));else if(Array.isArray(e))for(let[t,r]of e)this.set(t,String(r));else if(typeof e=="object")for(let t of Object.keys(e))this.set(t,String(e[t]))}}append(e,t){let r=e.toLowerCase(),n=this.headerMap.get(r);this.headerMap.set(r,n?`${n}, ${t}`:t)}set(e,t){this.headerMap.set(e.toLowerCase(),String(t))}get(e){let t=this.headerMap.get(e.toLowerCase());return t??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[t,r]of this.headerMap.entries())e(r,t,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},R=class s{constructor(e){this.params=new Map;if(e){if(typeof e=="string")this.parseString(e);else if(e instanceof s)this.params=new Map(e.params);else if(Array.isArray(e))for(let[t,r]of e)this.append(t,r);else if(e&&typeof e=="object")for(let[t,r]of Object.entries(e))this.set(t,r)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let t=e.split("&");for(let r of t)if(r){let[n,o]=r.split("=");n&&this.append(decodeURIComponent(n),o?decodeURIComponent(o):"")}}append(e,t){let r=this.params.get(e)||[];r.push(t),this.params.set(e,r)}delete(e){this.params.delete(e)}get(e){let t=this.params.get(e);return t?t[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,t){this.params.set(e,[t])}sort(){let e=Array.from(this.params.entries()).sort(([t],[r])=>t.localeCompare(r));this.params=new Map(e)}toString(){let e=[];for(let[t,r]of this.params.entries())for(let n of r)e.push(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`);return e.join("&")}forEach(e){for(let[t,r]of this.params.entries())for(let n of r)e(n,t,this)}keys(){return this.params.keys()}values(){let e=[];for(let t of this.params.values())e.push(...t);return e[Symbol.iterator]()}entries(){let e=[];for(let[t,r]of this.params.entries())for(let n of r)e.push([t,n]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},I=class s{constructor(e,t){let r;if(e instanceof s)r=e.href;else if(t){let o=t instanceof s?t.href:t;r=this.resolve(o,e)}else r=e;let n=this.parseUrl(r);this.href=r,this.origin=`${n.protocol}//${n.host}`,this.protocol=n.protocol,this.username=n.username,this.password=n.password,this.host=n.host,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.searchParams=new R(n.search),this.hash=n.hash}resolve(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(t.startsWith("//"))return`${this.parseUrl(e).protocol}${t}`;if(t.startsWith("/")){let o=this.parseUrl(e);return`${o.protocol}//${o.host}${t}`}let r=this.parseUrl(e),n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return`${r.protocol}//${r.host}${n}${t}`}parseUrl(e){let t=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)throw new TypeError("Invalid URL");let r=t[2]||"",n=t[4]||"",o=t[5]||"/",i=t[7]?`?${t[7]}`:"",a=t[9]?`#${t[9]}`:"";if(!r&&!n&&!o.startsWith("/")&&!o.includes("/")&&!o.includes("."))throw new TypeError("Invalid URL");let c=n.match(/^([^@]*)@(.+)$/),l="",u="",d=n;if(c){let b=c[1];d=c[2];let v=b.match(/^([^:]*):?(.*)$/);v&&(l=v[1]||"",u=v[2]||"")}let y=d.match(/^([^:]+):?(\d*)$/),p=y?y[1]:d,g=y&&y[2]?y[2]:"";return{protocol:r?`${r}:`:"",username:l,password:u,host:d,hostname:p,port:g,pathname:o,search:i,hash:a}}toString(){let e=this.searchParams.toString(),t=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${t}${this.hash}`}toJSON(){return this.toString()}};h();var U=class s{constructor(e,t){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(t?.method||"GET").toUpperCase(),this.headers=t?.headers instanceof P?t.headers:new P(t?.headers),this.body=t?.body,this.timeout=t?.timeout,this.signal=t?.signal||void 0}clone(){return new s(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};h();var L=class{constructor(e,t){this.bodyData=e,this.status=t?.status??200,this.statusText=t?.statusText??"",this.headers=at(t?.headers),this.ok=this.status>=200&&this.status<300}async text(){return typeof this.bodyData=="string"?this.bodyData:this.bodyData==null?"":typeof this.bodyData=="object"?JSON.stringify(this.bodyData):String(this.bodyData)}async json(){if(typeof this.bodyData=="string")try{return JSON.parse(this.bodyData)}catch{}return this.bodyData}async arrayBuffer(){let e=await this.text();return new TextEncoder().encode(e).buffer}};function at(s){return s?new P(s):new P}h();var j=class{constructor(){this._aborted=!1;this.listeners=new Set;this.onabort=null}get aborted(){return this._aborted}_trigger(){if(!this._aborted){if(this._aborted=!0,typeof this.onabort=="function")try{this.onabort()}catch{}for(let e of Array.from(this.listeners))try{e()}catch{}this.listeners.clear()}}addEventListener(e,t){if(this._aborted){try{t()}catch{}return}this.listeners.add(t)}removeEventListener(e,t){this.listeners.delete(t)}toString(){return"[object AbortSignal]"}},N=class{constructor(){this._signal=new j}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};h();function Yt(s){s.URL=I,s.URLSearchParams=R,s.Headers=P,s.Request=U,s.Response=L,s.AbortController=N,s.AbortSignal=j}var de=class{constructor(e,t,r){console.log("NvwaHttpClient constructor",e,t,r),this.storage=e,this.customFetch=t,this.handleUnauthorized=r}async fetch(e,t){return await this.customFetch(e,t)}async fetchWithAuth(e,t){let r=await this.storage.get(ue),n=new P(t?.headers);r&&n.set("Authorization",`Bearer ${r}`);let o=t?.method||"GET";if((o==="POST"||o==="PUT"||o==="PATCH")&&t?.body){let a=n.get("Content-Type");(!a||a.includes("text/plain"))&&n.set("Content-Type","application/json")}let i=await this.customFetch(e,{...t,headers:n});if(i.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return i}};h();var lt="/storage",ct=lt+"/generateUploadUrl",pe=class{constructor(e,t){this.baseUrl=e,this.http=t}async uploadFile(e){let t=await this.http.fetch(this.baseUrl+ct,{method:"POST",body:{fileName:e.name||e.fileName,fileSize:e.size||e.fileSize,fileType:e.type||e.fileType}}),{url:r}=await t.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let n=await this.http.fetch(r,{method:"PUT",body:e,headers:new P({"Content-Type":e.type||e.fileType||"application/octet-stream"})}),{url:o}=await n.json();return{url:o.split("?")[0]}}};h();h();h();var ae=it(Ye(),1),{PostgrestClient:Qe,PostgrestQueryBuilder:Ir,PostgrestFilterBuilder:Ur,PostgrestTransformBuilder:Lr,PostgrestBuilder:Nr,PostgrestError:kr}=ae.default||ae;var Et="/entities",Br=(s,e)=>new Qe(s+Et,{fetch:e.fetchWithAuth.bind(e)});h();var Ke=class{constructor(e,t){this.baseUrl=e,this.http=t}async execute(e,t){let r=`${this.baseUrl}/skill/${e}/execute`,o=await(await this.http.fetchWithAuth(r,{method:"POST",body:t?JSON.stringify(t):void 0,timeout:6e5})).json();if(o.status!==200)throw new Error(o.message);return o.data}};h();var Xe=class{constructor(){this.hoverOverlay=null;this.selectedOverlay=null;this.tooltip=null;this.hoverElement=null;this.selectedElement=null;this.hoverUpdateHandler=null;this.selectedUpdateHandler=null;this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let e=document.createElement("style");e.id="__nvwa-inspector-overlay-style",e.textContent=`
1
+ var et=Object.create;var A=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var rt=Object.getOwnPropertyNames;var st=Object.getPrototypeOf,nt=Object.prototype.hasOwnProperty;var le=(s,e)=>()=>(s&&(e=s(s=0)),e);var E=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports),ot=(s,e)=>{for(var t in e)A(s,t,{get:e[t],enumerable:!0})},ce=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of rt(e))!nt.call(s,n)&&n!==t&&A(s,n,{get:()=>e[n],enumerable:!(r=tt(e,n))||r.enumerable});return s};var it=(s,e,t)=>(t=s!=null?et(st(s)):{},ce(e||!s||!s.__esModule?A(t,"default",{value:s,enumerable:!0}):t,s)),S=s=>ce(A({},"__esModule",{value:!0}),s);import $t from"path";import{fileURLToPath as Rt}from"url";var h=le(()=>{"use strict"});var x={};ot(x,{__addDisposableResource:()=>ke,__assign:()=>k,__asyncDelegator:()=>je,__asyncGenerator:()=>Re,__asyncValues:()=>He,__await:()=>$,__awaiter:()=>Ee,__classPrivateFieldGet:()=>Ue,__classPrivateFieldIn:()=>Ne,__classPrivateFieldSet:()=>Le,__createBinding:()=>q,__decorate:()=>ye,__disposeResources:()=>Me,__esDecorate:()=>ve,__exportStar:()=>Oe,__extends:()=>fe,__generator:()=>xe,__importDefault:()=>Ie,__importStar:()=>Ae,__makeTemplateObject:()=>Ce,__metadata:()=>_e,__param:()=>ge,__propKey:()=>be,__read:()=>z,__rest:()=>me,__rewriteRelativeImportExtension:()=>qe,__runInitializers:()=>we,__setFunctionName:()=>Pe,__spread:()=>Se,__spreadArray:()=>Te,__spreadArrays:()=>$e,__values:()=>M,default:()=>dt});function fe(s,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");B(s,e);function t(){this.constructor=s}s.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function me(s,e){var t={};for(var r in s)Object.prototype.hasOwnProperty.call(s,r)&&e.indexOf(r)<0&&(t[r]=s[r]);if(s!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,r=Object.getOwnPropertySymbols(s);n<r.length;n++)e.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(s,r[n])&&(t[r[n]]=s[r[n]]);return t}function ye(s,e,t,r){var n=arguments.length,o=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(s,e,t,r);else for(var a=s.length-1;a>=0;a--)(i=s[a])&&(o=(n<3?i(o):n>3?i(e,t,o):i(e,t))||o);return n>3&&o&&Object.defineProperty(e,t,o),o}function ge(s,e){return function(t,r){e(t,r,s)}}function ve(s,e,t,r,n,o){function i(_){if(_!==void 0&&typeof _!="function")throw new TypeError("Function expected");return _}for(var a=r.kind,c=a==="getter"?"get":a==="setter"?"set":"value",l=!e&&s?r.static?s:s.prototype:null,u=e||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,y=!1,p=t.length-1;p>=0;p--){var g={};for(var b in r)g[b]=b==="access"?{}:r[b];for(var b in r.access)g.access[b]=r.access[b];g.addInitializer=function(_){if(y)throw new TypeError("Cannot add initializers after decoration has completed");o.push(i(_||null))};var v=(0,t[p])(a==="accessor"?{get:u.get,set:u.set}:u[c],g);if(a==="accessor"){if(v===void 0)continue;if(v===null||typeof v!="object")throw new TypeError("Object expected");(d=i(v.get))&&(u.get=d),(d=i(v.set))&&(u.set=d),(d=i(v.init))&&n.unshift(d)}else(d=i(v))&&(a==="field"?n.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),y=!0}function we(s,e,t){for(var r=arguments.length>2,n=0;n<e.length;n++)t=r?e[n].call(s,t):e[n].call(s);return r?t:void 0}function be(s){return typeof s=="symbol"?s:"".concat(s)}function Pe(s,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(s,"name",{configurable:!0,value:t?"".concat(t," ",e):e})}function _e(s,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(s,e)}function Ee(s,e,t,r){function n(o){return o instanceof t?o:new t(function(i){i(o)})}return new(t||(t=Promise))(function(o,i){function a(u){try{l(r.next(u))}catch(d){i(d)}}function c(u){try{l(r.throw(u))}catch(d){i(d)}}function l(u){u.done?o(u.value):n(u.value).then(a,c)}l((r=r.apply(s,e||[])).next())})}function xe(s,e){var t={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,n,o,i=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return i.next=a(0),i.throw=a(1),i.return=a(2),typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function a(l){return function(u){return c([l,u])}}function c(l){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(t=0)),t;)try{if(r=1,n&&(o=l[0]&2?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[l[0]&2,o.value]),l[0]){case 0:case 1:o=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,n=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(o=t.trys,!(o=o.length>0&&o[o.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!o||l[1]>o[0]&&l[1]<o[3])){t.label=l[1];break}if(l[0]===6&&t.label<o[1]){t.label=o[1],o=l;break}if(o&&t.label<o[2]){t.label=o[2],t.ops.push(l);break}o[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(s,t)}catch(u){l=[6,u],n=0}finally{r=o=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Oe(s,e){for(var t in s)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&q(e,s,t)}function M(s){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&s[e],r=0;if(t)return t.call(s);if(s&&typeof s.length=="number")return{next:function(){return s&&r>=s.length&&(s=void 0),{value:s&&s[r++],done:!s}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(s,e){var t=typeof Symbol=="function"&&s[Symbol.iterator];if(!t)return s;var r=t.call(s),n,o=[],i;try{for(;(e===void 0||e-- >0)&&!(n=r.next()).done;)o.push(n.value)}catch(a){i={error:a}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(i)throw i.error}}return o}function Se(){for(var s=[],e=0;e<arguments.length;e++)s=s.concat(z(arguments[e]));return s}function $e(){for(var s=0,e=0,t=arguments.length;e<t;e++)s+=arguments[e].length;for(var r=Array(s),n=0,e=0;e<t;e++)for(var o=arguments[e],i=0,a=o.length;i<a;i++,n++)r[n]=o[i];return r}function Te(s,e,t){if(t||arguments.length===2)for(var r=0,n=e.length,o;r<n;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return s.concat(o||Array.prototype.slice.call(e))}function $(s){return this instanceof $?(this.v=s,this):new $(s)}function Re(s,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t.apply(s,e||[]),n,o=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",i),n[Symbol.asyncIterator]=function(){return this},n;function i(p){return function(g){return Promise.resolve(g).then(p,d)}}function a(p,g){r[p]&&(n[p]=function(b){return new Promise(function(v,_){o.push([p,b,v,_])>1||c(p,b)})},g&&(n[p]=g(n[p])))}function c(p,g){try{l(r[p](g))}catch(b){y(o[0][3],b)}}function l(p){p.value instanceof $?Promise.resolve(p.value.v).then(u,d):y(o[0][2],p)}function u(p){c("next",p)}function d(p){c("throw",p)}function y(p,g){p(g),o.shift(),o.length&&c(o[0][0],o[0][1])}}function je(s){var e,t;return e={},r("next"),r("throw",function(n){throw n}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(n,o){e[n]=s[n]?function(i){return(t=!t)?{value:$(s[n](i)),done:!1}:o?o(i):i}:o}}function He(s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=s[Symbol.asyncIterator],t;return e?e.call(s):(s=typeof M=="function"?M(s):s[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=s[o]&&function(i){return new Promise(function(a,c){i=s[o](i),n(a,c,i.done,i.value)})}}function n(o,i,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},i)}}function Ce(s,e){return Object.defineProperty?Object.defineProperty(s,"raw",{value:e}):s.raw=e,s}function Ae(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t=F(s),r=0;r<t.length;r++)t[r]!=="default"&&q(e,s,t[r]);return ht(e,s),e}function Ie(s){return s&&s.__esModule?s:{default:s}}function Ue(s,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?s!==e||!r:!e.has(s))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(s):r?r.value:e.get(s)}function Le(s,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?s!==e||!n:!e.has(s))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(s,t):n?n.value=t:e.set(s,t),t}function Ne(s,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof s=="function"?e===s:s.has(e)}function ke(s,e,t){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var r,n;if(t){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=e[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=e[Symbol.dispose],t&&(n=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");n&&(r=function(){try{n.call(this)}catch(o){return Promise.reject(o)}}),s.stack.push({value:e,dispose:r,async:t})}else t&&s.stack.push({async:!0});return e}function Me(s){function e(o){s.error=s.hasError?new ut(o,s.error,"An error was suppressed during disposal."):o,s.hasError=!0}var t,r=0;function n(){for(;t=s.stack.pop();)try{if(!t.async&&r===1)return r=0,s.stack.push(t),Promise.resolve().then(n);if(t.dispose){var o=t.dispose.call(t.value);if(t.async)return r|=2,Promise.resolve(o).then(n,function(i){return e(i),n()})}else r|=1}catch(i){e(i)}if(r===1)return s.hasError?Promise.reject(s.error):Promise.resolve();if(s.hasError)throw s.error}return n()}function qe(s,e){return typeof s=="string"&&/^\.\.?\//.test(s)?s.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(t,r,n,o,i){return r?e?".jsx":".js":n&&(!o||!i)?t:n+o+"."+i.toLowerCase()+"js"}):s}var B,k,q,ht,F,ut,dt,O=le(()=>{"use strict";h();B=function(s,e){return B=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},B(s,e)};k=function(){return k=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},k.apply(this,arguments)};q=Object.create?(function(s,e,t,r){r===void 0&&(r=t);var n=Object.getOwnPropertyDescriptor(e,t);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(s,r,n)}):(function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]});ht=Object.create?(function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}):function(s,e){s.default=e},F=function(s){return F=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},F(s)};ut=typeof SuppressedError=="function"?SuppressedError:function(s,e,t){var r=new Error(t);return r.name="SuppressedError",r.error=s,r.suppressed=e,r};dt={__extends:fe,__assign:k,__rest:me,__decorate:ye,__param:ge,__esDecorate:ve,__runInitializers:we,__propKey:be,__setFunctionName:Pe,__metadata:_e,__awaiter:Ee,__generator:xe,__createBinding:q,__exportStar:Oe,__values:M,__read:z,__spread:Se,__spreadArrays:$e,__spreadArray:Te,__await:$,__asyncGenerator:Re,__asyncDelegator:je,__asyncValues:He,__makeTemplateObject:Ce,__importStar:Ae,__importDefault:Ie,__classPrivateFieldGet:Ue,__classPrivateFieldSet:Le,__classPrivateFieldIn:Ne,__addDisposableResource:ke,__disposeResources:Me,__rewriteRelativeImportExtension:qe}});var W=E(J=>{"use strict";h();Object.defineProperty(J,"__esModule",{value:!0});var G=class extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.code=e.code}};J.default=G});var Q=E(Y=>{"use strict";h();Object.defineProperty(Y,"__esModule",{value:!0});var pt=(O(),S(x)),ft=pt.__importDefault(W()),V=class{constructor(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=(t=e.shouldThrowOnError)!==null&&t!==void 0?t:!1,this.signal=e.signal,this.isMaybeSingle=(r=e.isMaybeSingle)!==null&&r!==void 0?r:!1,e.fetch?this.fetch=e.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");let r=this.fetch,n=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async o=>{var i,a,c,l;let u=null,d=null,y=null,p=o.status,g=o.statusText;if(o.ok){if(this.method!=="HEAD"){let C=await o.text();C===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text"))?d=C:d=JSON.parse(C))}let v=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),_=(c=o.headers.get("content-range"))===null||c===void 0?void 0:c.split("/");v&&_&&_.length>1&&(y=parseInt(_[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(u={code:"PGRST116",details:`Results contain ${d.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},d=null,y=null,p=406,g="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let v=await o.text();try{u=JSON.parse(v),Array.isArray(u)&&o.status===404&&(d=[],u=null,p=200,g="OK")}catch{o.status===404&&v===""?(p=204,g="No Content"):u={message:v}}if(u&&this.isMaybeSingle&&(!((l=u?.details)===null||l===void 0)&&l.includes("0 rows"))&&(u=null,p=200,g="OK"),u&&this.shouldThrowOnError)throw new ft.default(u)}return{error:u,data:d,count:y,status:p,statusText:g}});return this.shouldThrowOnError||(n=n.catch(o=>{var i,a,c;return{error:{message:`${(i=o?.name)!==null&&i!==void 0?i:"FetchError"}: ${o?.message}`,details:`${(a=o?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(c=o?.code)!==null&&c!==void 0?c:""}`},data:null,count:null,status:0,statusText:""}})),n.then(e,t)}returns(){return this}overrideTypes(){return this}};Y.default=V});var Z=E(X=>{"use strict";h();Object.defineProperty(X,"__esModule",{value:!0});var mt=(O(),S(x)),yt=mt.__importDefault(Q()),K=class extends yt.default{select(e){let t=!1,r=(e??"*").split("").map(n=>/\s/.test(n)&&!t?"":(n==='"'&&(t=!t),n)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:n,referencedTable:o=n}={}){let i=o?`${o}.order`:"order",a=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${a?`${a},`:""}${e}.${t?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let n=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(n,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:n=r}={}){let o=typeof n>"u"?"offset":`${n}.offset`,i=typeof n>"u"?"limit":`${n}.limit`;return this.url.searchParams.set(o,`${e}`),this.url.searchParams.set(i,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:n=!1,wal:o=!1,format:i="text"}={}){var a;let c=[e?"analyze":null,t?"verbose":null,r?"settings":null,n?"buffers":null,o?"wal":null].filter(Boolean).join("|"),l=(a=this.headers.get("Accept"))!==null&&a!==void 0?a:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${l}"; options=${c};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}};X.default=K});var D=E(te=>{"use strict";h();Object.defineProperty(te,"__esModule",{value:!0});var gt=(O(),S(x)),vt=gt.__importDefault(Z()),wt=new RegExp("[,()]"),ee=class extends vt.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(n=>typeof n=="string"&&wt.test(n)?`"${n}"`:`${n}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return typeof t=="string"?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return typeof t=="string"?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:n}={}){let o="";n==="plain"?o="pl":n==="phrase"?o="ph":n==="websearch"&&(o="w");let i=r===void 0?"":`(${r})`;return this.url.searchParams.append(e,`${o}fts${i}.${t}`),this}match(e){return Object.entries(e).forEach(([t,r])=>{this.url.searchParams.append(t,`eq.${r}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let n=r?`${r}.or`:"or";return this.url.searchParams.append(n,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}};te.default=ee});var ne=E(se=>{"use strict";h();Object.defineProperty(se,"__esModule",{value:!0});var bt=(O(),S(x)),H=bt.__importDefault(D()),re=class{constructor(e,{headers:t={},schema:r,fetch:n}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=n}select(e,t){let{head:r=!1,count:n}=t??{},o=r?"HEAD":"GET",i=!1,a=(e??"*").split("").map(c=>/\s/.test(c)&&!i?"":(c==='"'&&(i=!i),c)).join("");return this.url.searchParams.set("select",a),n&&this.headers.append("Prefer",`count=${n}`),new H.default({method:o,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;let o="POST";if(t&&this.headers.append("Prefer",`count=${t}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let i=e.reduce((a,c)=>a.concat(Object.keys(c)),[]);if(i.length>0){let a=[...new Set(i)].map(c=>`"${c}"`);this.url.searchParams.set("columns",a.join(","))}}return new H.default({method:o,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:o=!0}={}){var i;let a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),t!==void 0&&this.url.searchParams.set("on_conflict",t),n&&this.headers.append("Prefer",`count=${n}`),o||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let c=e.reduce((l,u)=>l.concat(Object.keys(u)),[]);if(c.length>0){let l=[...new Set(c)].map(u=>`"${u}"`);this.url.searchParams.set("columns",l.join(","))}}return new H.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(e,{count:t}={}){var r;let n="PATCH";return t&&this.headers.append("Prefer",`count=${t}`),new H.default({method:n,url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:e}={}){var t;let r="DELETE";return e&&this.headers.append("Prefer",`count=${e}`),new H.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(t=this.fetch)!==null&&t!==void 0?t:fetch})}};se.default=re});var Be=E(ie=>{"use strict";h();Object.defineProperty(ie,"__esModule",{value:!0});var De=(O(),S(x)),Pt=De.__importDefault(ne()),_t=De.__importDefault(D()),oe=class s{constructor(e,{headers:t={},schema:r,fetch:n}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=n}from(e){let t=new URL(`${this.url}/${e}`);return new Pt.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new s(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:n=!1,count:o}={}){var i;let a,c=new URL(`${this.url}/rpc/${e}`),l;r||n?(a=r?"HEAD":"GET",Object.entries(t).filter(([d,y])=>y!==void 0).map(([d,y])=>[d,Array.isArray(y)?`{${y.join(",")}}`:`${y}`]).forEach(([d,y])=>{c.searchParams.append(d,y)})):(a="POST",l=t);let u=new Headers(this.headers);return o&&u.set("Prefer",`count=${o}`),new _t.default({method:a,url:c,headers:u,schema:this.schemaName,body:l,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}};ie.default=oe});var Ye=E(w=>{"use strict";h();Object.defineProperty(w,"__esModule",{value:!0});w.PostgrestError=w.PostgrestBuilder=w.PostgrestTransformBuilder=w.PostgrestFilterBuilder=w.PostgrestQueryBuilder=w.PostgrestClient=void 0;var T=(O(),S(x)),Fe=T.__importDefault(Be());w.PostgrestClient=Fe.default;var ze=T.__importDefault(ne());w.PostgrestQueryBuilder=ze.default;var Ge=T.__importDefault(D());w.PostgrestFilterBuilder=Ge.default;var Je=T.__importDefault(Z());w.PostgrestTransformBuilder=Je.default;var We=T.__importDefault(Q());w.PostgrestBuilder=We.default;var Ve=T.__importDefault(W());w.PostgrestError=Ve.default;w.default={PostgrestClient:Fe.default,PostgrestQueryBuilder:ze.default,PostgrestFilterBuilder:Ge.default,PostgrestTransformBuilder:Je.default,PostgrestBuilder:We.default,PostgrestError:Ve.default}});h();h();var he=class{constructor(e,t=""){this.http=e,this.baseUrl=t.replace(/\/$/,"")}async invoke(e,t){let r=this.baseUrl?`${this.baseUrl}/functions/${e}`:`/functions/${e}`;return await(await this.http.fetch(r,{method:t.method||"POST",body:t.body,headers:t.headers})).json()}};h();h();var ue="nvwa_current_jwt";h();h();var P=class s{constructor(e){this.headerMap=new Map;if(e){if(e instanceof s)e.forEach((t,r)=>this.set(r,t));else if(Array.isArray(e))for(let[t,r]of e)this.set(t,String(r));else if(typeof e=="object")for(let t of Object.keys(e))this.set(t,String(e[t]))}}append(e,t){let r=e.toLowerCase(),n=this.headerMap.get(r);this.headerMap.set(r,n?`${n}, ${t}`:t)}set(e,t){this.headerMap.set(e.toLowerCase(),String(t))}get(e){let t=this.headerMap.get(e.toLowerCase());return t??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[t,r]of this.headerMap.entries())e(r,t,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},R=class s{constructor(e){this.params=new Map;if(e){if(typeof e=="string")this.parseString(e);else if(e instanceof s)this.params=new Map(e.params);else if(Array.isArray(e))for(let[t,r]of e)this.append(t,r);else if(e&&typeof e=="object")for(let[t,r]of Object.entries(e))this.set(t,r)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let t=e.split("&");for(let r of t)if(r){let[n,o]=r.split("=");n&&this.append(decodeURIComponent(n),o?decodeURIComponent(o):"")}}append(e,t){let r=this.params.get(e)||[];r.push(t),this.params.set(e,r)}delete(e){this.params.delete(e)}get(e){let t=this.params.get(e);return t?t[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,t){this.params.set(e,[t])}sort(){let e=Array.from(this.params.entries()).sort(([t],[r])=>t.localeCompare(r));this.params=new Map(e)}toString(){let e=[];for(let[t,r]of this.params.entries())for(let n of r)e.push(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`);return e.join("&")}forEach(e){for(let[t,r]of this.params.entries())for(let n of r)e(n,t,this)}keys(){return this.params.keys()}values(){let e=[];for(let t of this.params.values())e.push(...t);return e[Symbol.iterator]()}entries(){let e=[];for(let[t,r]of this.params.entries())for(let n of r)e.push([t,n]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},I=class s{constructor(e,t){let r;if(e instanceof s)r=e.href;else if(t){let o=t instanceof s?t.href:t;r=this.resolve(o,e)}else r=e;let n=this.parseUrl(r);this.href=r,this.origin=`${n.protocol}//${n.host}`,this.protocol=n.protocol,this.username=n.username,this.password=n.password,this.host=n.host,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.searchParams=new R(n.search),this.hash=n.hash}resolve(e,t){if(t.startsWith("http://")||t.startsWith("https://"))return t;if(t.startsWith("//"))return`${this.parseUrl(e).protocol}${t}`;if(t.startsWith("/")){let o=this.parseUrl(e);return`${o.protocol}//${o.host}${t}`}let r=this.parseUrl(e),n=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return`${r.protocol}//${r.host}${n}${t}`}parseUrl(e){let t=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)throw new TypeError("Invalid URL");let r=t[2]||"",n=t[4]||"",o=t[5]||"/",i=t[7]?`?${t[7]}`:"",a=t[9]?`#${t[9]}`:"";if(!r&&!n&&!o.startsWith("/")&&!o.includes("/")&&!o.includes("."))throw new TypeError("Invalid URL");let c=n.match(/^([^@]*)@(.+)$/),l="",u="",d=n;if(c){let b=c[1];d=c[2];let v=b.match(/^([^:]*):?(.*)$/);v&&(l=v[1]||"",u=v[2]||"")}let y=d.match(/^([^:]+):?(\d*)$/),p=y?y[1]:d,g=y&&y[2]?y[2]:"";return{protocol:r?`${r}:`:"",username:l,password:u,host:d,hostname:p,port:g,pathname:o,search:i,hash:a}}toString(){let e=this.searchParams.toString(),t=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${t}${this.hash}`}toJSON(){return this.toString()}};h();var U=class s{constructor(e,t){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(t?.method||"GET").toUpperCase(),this.headers=t?.headers instanceof P?t.headers:new P(t?.headers),this.body=t?.body,this.timeout=t?.timeout,this.signal=t?.signal||void 0}clone(){return new s(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};h();var L=class{constructor(e,t){this.bodyData=e,this.status=t?.status??200,this.statusText=t?.statusText??"",this.headers=at(t?.headers),this.ok=this.status>=200&&this.status<300}async text(){return typeof this.bodyData=="string"?this.bodyData:this.bodyData==null?"":typeof this.bodyData=="object"?JSON.stringify(this.bodyData):String(this.bodyData)}async json(){if(typeof this.bodyData=="string")try{return JSON.parse(this.bodyData)}catch{}return this.bodyData}async arrayBuffer(){let e=await this.text();return new TextEncoder().encode(e).buffer}};function at(s){return s?new P(s):new P}h();var j=class{constructor(){this._aborted=!1;this.listeners=new Set;this.onabort=null}get aborted(){return this._aborted}_trigger(){if(!this._aborted){if(this._aborted=!0,typeof this.onabort=="function")try{this.onabort()}catch{}for(let e of Array.from(this.listeners))try{e()}catch{}this.listeners.clear()}}addEventListener(e,t){if(this._aborted){try{t()}catch{}return}this.listeners.add(t)}removeEventListener(e,t){this.listeners.delete(t)}toString(){return"[object AbortSignal]"}},N=class{constructor(){this._signal=new j}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};h();function Yt(s){s.URL=I,s.URLSearchParams=R,s.Headers=P,s.Request=U,s.Response=L,s.AbortController=N,s.AbortSignal=j}var de=class{constructor(e,t,r){console.log("NvwaHttpClient constructor",e,t,r),this.storage=e,this.customFetch=t,this.handleUnauthorized=r}async fetch(e,t){return await this.customFetch(e,t)}async fetchWithAuth(e,t){let r=await this.storage.get(ue),n=new P(t?.headers);r&&n.set("Authorization",`Bearer ${r}`);let o=t?.method||"GET";if((o==="POST"||o==="PUT"||o==="PATCH")&&t?.body){let a=n.get("Content-Type");(!a||a.includes("text/plain"))&&n.set("Content-Type","application/json")}let i=await this.customFetch(e,{...t,headers:n});if(i.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return i}};h();var lt="/storage",ct=lt+"/generateUploadUrl",pe=class{constructor(e,t){this.baseUrl=e,this.http=t}async uploadFile(e){let t=await this.http.fetch(this.baseUrl+ct,{method:"POST",body:{fileName:e.name||e.fileName,fileSize:e.size||e.fileSize,fileType:e.type||e.fileType}}),{url:r}=await t.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let n=await this.http.fetch(r,{method:"PUT",body:e,headers:new P({"Content-Type":e.type||e.fileType||"application/octet-stream"})}),{url:o}=await n.json();return{url:o.split("?")[0]}}};h();h();h();var ae=it(Ye(),1),{PostgrestClient:Qe,PostgrestQueryBuilder:Ir,PostgrestFilterBuilder:Ur,PostgrestTransformBuilder:Lr,PostgrestBuilder:Nr,PostgrestError:kr}=ae.default||ae;var Et="/entities",Br=(s,e)=>new Qe(s+Et,{fetch:e.fetchWithAuth.bind(e)});h();var Ke=class{constructor(e,t){this.baseUrl=e,this.http=t}async execute(e,t){let r=`${this.baseUrl}/skill/${e}/execute`,o=await(await this.http.fetchWithAuth(r,{method:"POST",body:t?JSON.stringify(t):void 0,timeout:6e5})).json();if(o.status!==200)throw new Error(o.message);return o.data}};h();var Xe=class{constructor(){this.hoverOverlay=null;this.selectedOverlay=null;this.tooltip=null;this.hoverElement=null;this.selectedElement=null;this.hoverUpdateHandler=null;this.selectedUpdateHandler=null;this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let e=document.createElement("style");e.id="__nvwa-inspector-overlay-style",e.textContent=`
2
2
  .__nvwa-inspector-overlay {
3
3
  position: absolute;
4
4
  pointer-events: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nvwa-app/sdk-core",
3
- "version": "0.11.0",
3
+ "version": "2.0.0",
4
4
  "description": "NVWA跨端通用工具类核心接口",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",