@nvwa-app/sdk-core 6.0.48 → 6.0.49
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 +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -428,9 +428,9 @@ declare class AuthClient {
|
|
|
428
428
|
}>;
|
|
429
429
|
/**
|
|
430
430
|
* 查询当前登录用户绑定的微信开放平台身份(openid)。
|
|
431
|
-
*
|
|
431
|
+
* 建议传 applicationCode(runtime 会解析对应 appId);如不传且存在多绑定会返回冲突错误。
|
|
432
432
|
*/
|
|
433
|
-
getWeChatOpenPlatformIdentity(
|
|
433
|
+
getWeChatOpenPlatformIdentity(applicationCode?: string): Promise<{
|
|
434
434
|
data?: WeChatOpenPlatformIdentity;
|
|
435
435
|
error?: {
|
|
436
436
|
message: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -428,9 +428,9 @@ declare class AuthClient {
|
|
|
428
428
|
}>;
|
|
429
429
|
/**
|
|
430
430
|
* 查询当前登录用户绑定的微信开放平台身份(openid)。
|
|
431
|
-
*
|
|
431
|
+
* 建议传 applicationCode(runtime 会解析对应 appId);如不传且存在多绑定会返回冲突错误。
|
|
432
432
|
*/
|
|
433
|
-
getWeChatOpenPlatformIdentity(
|
|
433
|
+
getWeChatOpenPlatformIdentity(applicationCode?: string): Promise<{
|
|
434
434
|
data?: WeChatOpenPlatformIdentity;
|
|
435
435
|
error?: {
|
|
436
436
|
message: string;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ae=Object.create;var q=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var wt=(n,t)=>()=>(n&&(t=n(n=0)),t);var x=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),vt=(n,t)=>{for(var e in t)q(n,e,{get:t[e],enumerable:!0})},bt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ue(t))!ce.call(n,s)&&s!==e&&q(n,s,{get:()=>t[s],enumerable:!(r=le(t,s))||r.enumerable});return n};var de=(n,t,e)=>(e=n!=null?ae(he(n)):{},bt(t||!n||!n.__esModule?q(e,"default",{value:n,enumerable:!0}):e,n)),O=n=>bt(q({},"__esModule",{value:!0}),n);var u=wt(()=>{"use strict"});var R={};vt(R,{__addDisposableResource:()=>Gt,__assign:()=>D,__asyncDelegator:()=>qt,__asyncGenerator:()=>kt,__asyncValues:()=>Mt,__await:()=>U,__awaiter:()=>Ct,__classPrivateFieldGet:()=>Wt,__classPrivateFieldIn:()=>Jt,__classPrivateFieldSet:()=>zt,__createBinding:()=>F,__decorate:()=>Ot,__disposeResources:()=>Kt,__esDecorate:()=>Rt,__exportStar:()=>Lt,__extends:()=>Et,__generator:()=>jt,__importDefault:()=>Ft,__importStar:()=>Bt,__makeTemplateObject:()=>Dt,__metadata:()=>Ut,__param:()=>St,__propKey:()=>$t,__read:()=>Q,__rest:()=>xt,__rewriteRelativeImportExtension:()=>Yt,__runInitializers:()=>Tt,__setFunctionName:()=>At,__spread:()=>Nt,__spreadArray:()=>It,__spreadArrays:()=>Ht,__values:()=>B,default:()=>we});function Et(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Y(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function xt(n,t){var e={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(e[r[s]]=n[r[s]]);return e}function Ot(n,t,e,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(s<3?o(i):s>3?o(t,e,i):o(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i}function St(n,t){return function(e,r){t(e,r,n)}}function Rt(n,t,e,r,s,i){function o(_){if(_!==void 0&&typeof _!="function")throw new TypeError("Function expected");return _}for(var a=r.kind,h=a==="getter"?"get":a==="setter"?"set":"value",l=!t&&n?r.static?n:n.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,g=!1,p=e.length-1;p>=0;p--){var m={};for(var b in r)m[b]=b==="access"?{}:r[b];for(var b in r.access)m.access[b]=r.access[b];m.addInitializer=function(_){if(g)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(_||null))};var y=(0,e[p])(a==="accessor"?{get:c.get,set:c.set}:c[h],m);if(a==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=o(y.get))&&(c.get=d),(d=o(y.set))&&(c.set=d),(d=o(y.init))&&s.unshift(d)}else(d=o(y))&&(a==="field"?s.unshift(d):c[h]=d)}l&&Object.defineProperty(l,r.name,c),g=!0}function Tt(n,t,e){for(var r=arguments.length>2,s=0;s<t.length;s++)e=r?t[s].call(n,e):t[s].call(n);return r?e:void 0}function $t(n){return typeof n=="symbol"?n:"".concat(n)}function At(n,t,e){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(n,"name",{configurable:!0,value:e?"".concat(e," ",t):t})}function Ut(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)}function Ct(n,t,e,r){function s(i){return i instanceof e?i:new e(function(o){o(i)})}return new(e||(e=Promise))(function(i,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function h(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?i(c.value):s(c.value).then(a,h)}l((r=r.apply(n,t||[])).next())})}function jt(n,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(r=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){e.label=l[1];break}if(l[0]===6&&e.label<i[1]){e.label=i[1],i=l;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(l);break}i[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],s=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Lt(n,t){for(var e in n)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&F(t,n,e)}function B(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],r=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Q(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var r=e.call(n),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(o)throw o.error}}return i}function Nt(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(Q(arguments[t]));return n}function Ht(){for(var n=0,t=0,e=arguments.length;t<e;t++)n+=arguments[t].length;for(var r=Array(n),s=0,t=0;t<e;t++)for(var i=arguments[t],o=0,a=i.length;o<a;o++,s++)r[s]=i[o];return r}function It(n,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return n.concat(i||Array.prototype.slice.call(t))}function U(n){return this instanceof U?(this.v=n,this):new U(n)}function kt(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(n,t||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(p){return function(m){return Promise.resolve(m).then(p,d)}}function a(p,m){r[p]&&(s[p]=function(b){return new Promise(function(y,_){i.push([p,b,y,_])>1||h(p,b)})},m&&(s[p]=m(s[p])))}function h(p,m){try{l(r[p](m))}catch(b){g(i[0][3],b)}}function l(p){p.value instanceof U?Promise.resolve(p.value.v).then(c,d):g(i[0][2],p)}function c(p){h("next",p)}function d(p){h("throw",p)}function g(p,m){p(m),i.shift(),i.length&&h(i[0][0],i[0][1])}}function qt(n){var t,e;return t={},r("next"),r("throw",function(s){throw s}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(s,i){t[s]=n[s]?function(o){return(e=!e)?{value:U(n[s](o)),done:!1}:i?i(o):o}:i}}function Mt(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n[Symbol.asyncIterator],e;return t?t.call(n):(n=typeof B=="function"?B(n):n[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(i){e[i]=n[i]&&function(o){return new Promise(function(a,h){o=n[i](o),s(a,h,o.done,o.value)})}}function s(i,o,a,h){Promise.resolve(h).then(function(l){i({value:l,done:a})},o)}}function Dt(n,t){return Object.defineProperty?Object.defineProperty(n,"raw",{value:t}):n.raw=t,n}function Bt(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e=V(n),r=0;r<e.length;r++)e[r]!=="default"&&F(t,n,e[r]);return me(t,n),t}function Ft(n){return n&&n.__esModule?n:{default:n}}function Wt(n,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(n):r?r.value:t.get(n)}function zt(n,t,e,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,e):s?s.value=e:t.set(n,e),e}function Jt(n,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?t===n:n.has(t)}function Gt(n,t,e){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var r,s;if(e){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],e&&(s=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),n.stack.push({value:t,dispose:r,async:e})}else e&&n.stack.push({async:!0});return t}function Kt(n){function t(i){n.error=n.hasError?new ye(i,n.error,"An error was suppressed during disposal."):i,n.hasError=!0}var e,r=0;function s(){for(;e=n.stack.pop();)try{if(!e.async&&r===1)return r=0,n.stack.push(e),Promise.resolve().then(s);if(e.dispose){var i=e.dispose.call(e.value);if(e.async)return r|=2,Promise.resolve(i).then(s,function(o){return t(o),s()})}else r|=1}catch(o){t(o)}if(r===1)return n.hasError?Promise.reject(n.error):Promise.resolve();if(n.hasError)throw n.error}return s()}function Yt(n,t){return typeof n=="string"&&/^\.\.?\//.test(n)?n.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,s,i,o){return r?t?".jsx":".js":s&&(!i||!o)?e:s+i+"."+o.toLowerCase()+"js"}):n}var Y,D,F,me,V,ye,we,T=wt(()=>{"use strict";u();Y=function(n,t){return Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},Y(n,t)};D=function(){return D=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},D.apply(this,arguments)};F=Object.create?(function(n,t,e,r){r===void 0&&(r=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,r,s)}):(function(n,t,e,r){r===void 0&&(r=e),n[r]=t[e]});me=Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t},V=function(n){return V=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},V(n)};ye=typeof SuppressedError=="function"?SuppressedError:function(n,t,e){var r=new Error(e);return r.name="SuppressedError",r.error=n,r.suppressed=t,r};we={__extends:Et,__assign:D,__rest:xt,__decorate:Ot,__param:St,__esDecorate:Rt,__runInitializers:Tt,__propKey:$t,__setFunctionName:At,__metadata:Ut,__awaiter:Ct,__generator:jt,__createBinding:F,__exportStar:Lt,__values:B,__read:Q,__spread:Nt,__spreadArrays:Ht,__spreadArray:It,__await:U,__asyncGenerator:kt,__asyncDelegator:qt,__asyncValues:Mt,__makeTemplateObject:Dt,__importStar:Bt,__importDefault:Ft,__classPrivateFieldGet:Wt,__classPrivateFieldSet:zt,__classPrivateFieldIn:Jt,__addDisposableResource:Gt,__disposeResources:Kt,__rewriteRelativeImportExtension:Yt}});var tt=x(Z=>{"use strict";u();Object.defineProperty(Z,"__esModule",{value:!0});var X=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}};Z.default=X});var st=x(rt=>{"use strict";u();Object.defineProperty(rt,"__esModule",{value:!0});var ve=(T(),O(R)),be=ve.__importDefault(tt()),et=class{constructor(t){var e,r;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){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,s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,a,h,l;let c=null,d=null,g=null,p=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let k=await i.text();k===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?d=k:d=JSON.parse(k))}let y=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),_=(h=i.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");y&&_&&_.length>1&&(g=parseInt(_[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(c={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,g=null,p=406,m="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let y=await i.text();try{c=JSON.parse(y),Array.isArray(c)&&i.status===404&&(d=[],c=null,p=200,m="OK")}catch{i.status===404&&y===""?(p=204,m="No Content"):c={message:y}}if(c&&this.isMaybeSingle&&(!((l=c?.details)===null||l===void 0)&&l.includes("0 rows"))&&(c=null,p=200,m="OK"),c&&this.shouldThrowOnError)throw new be.default(c)}return{error:c,data:d,count:g,status:p,statusText:m}});return this.shouldThrowOnError||(s=s.catch(i=>{var o,a,h;return{error:{message:`${(o=i?.name)!==null&&o!==void 0?o:"FetchError"}: ${i?.message}`,details:`${(a=i?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(h=i?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),s.then(t,e)}returns(){return this}overrideTypes(){return this}};rt.default=et});var ot=x(it=>{"use strict";u();Object.defineProperty(it,"__esModule",{value:!0});var Pe=(T(),O(R)),_e=Pe.__importDefault(st()),nt=class extends _e.default{select(t){let e=!1,r=(t??"*").split("").map(s=>/\s/.test(s)&&!e?"":(s==='"'&&(e=!e),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:s,referencedTable:i=s}={}){let o=i?`${i}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){let s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:s=r}={}){let i=typeof s>"u"?"offset":`${s}.offset`,o=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(o,`${e-t+1}`),this}abortSignal(t){return this.signal=t,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:t=!1,verbose:e=!1,settings:r=!1,buffers:s=!1,wal:i=!1,format:o="text"}={}){var a;let h=[t?"analyze":null,e?"verbose":null,r?"settings":null,s?"buffers":null,i?"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+${o}; for="${l}"; options=${h};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};it.default=nt});var W=x(lt=>{"use strict";u();Object.defineProperty(lt,"__esModule",{value:!0});var Ee=(T(),O(R)),xe=Ee.__importDefault(ot()),Oe=new RegExp("[,()]"),at=class extends xe.default{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}in(t,e){let r=Array.from(new Set(e)).map(s=>typeof s=="string"&&Oe.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:s}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");let o=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${i}fts${o}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){let s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}};lt.default=at});var ct=x(ht=>{"use strict";u();Object.defineProperty(ht,"__esModule",{value:!0});var Se=(T(),O(R)),I=Se.__importDefault(W()),ut=class{constructor(t,{headers:e={},schema:r,fetch:s}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=s}select(t,e){let{head:r=!1,count:s}=e??{},i=r?"HEAD":"GET",o=!1,a=(t??"*").split("").map(h=>/\s/.test(h)&&!o?"":(h==='"'&&(o=!o),h)).join("");return this.url.searchParams.set("select",a),s&&this.headers.append("Prefer",`count=${s}`),new I.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:r=!0}={}){var s;let i="POST";if(e&&this.headers.append("Prefer",`count=${e}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let o=t.reduce((a,h)=>a.concat(Object.keys(h)),[]);if(o.length>0){let a=[...new Set(o)].map(h=>`"${h}"`);this.url.searchParams.set("columns",a.join(","))}}return new I.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:s,defaultToNull:i=!0}={}){var o;let a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),s&&this.headers.append("Prefer",`count=${s}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let h=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(h.length>0){let l=[...new Set(h)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new I.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(t,{count:e}={}){var r;let s="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new I.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:t}={}){var e;let r="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new I.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}};ht.default=ut});var Qt=x(pt=>{"use strict";u();Object.defineProperty(pt,"__esModule",{value:!0});var Vt=(T(),O(R)),Re=Vt.__importDefault(ct()),Te=Vt.__importDefault(W()),dt=class n{constructor(t,{headers:e={},schema:r,fetch:s}={}){this.url=t,this.headers=new Headers(e),this.schemaName=r,this.fetch=s}from(t){let e=new URL(`${this.url}/${t}`);return new Re.default(e,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new n(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,e={},{head:r=!1,get:s=!1,count:i}={}){var o;let a,h=new URL(`${this.url}/rpc/${t}`),l;r||s?(a=r?"HEAD":"GET",Object.entries(e).filter(([d,g])=>g!==void 0).map(([d,g])=>[d,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([d,g])=>{h.searchParams.append(d,g)})):(a="POST",l=e);let c=new Headers(this.headers);return i&&c.set("Prefer",`count=${i}`),new Te.default({method:a,url:h,headers:c,schema:this.schemaName,body:l,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};pt.default=dt});var ne=x(v=>{"use strict";u();Object.defineProperty(v,"__esModule",{value:!0});v.PostgrestError=v.PostgrestBuilder=v.PostgrestTransformBuilder=v.PostgrestFilterBuilder=v.PostgrestQueryBuilder=v.PostgrestClient=void 0;var C=(T(),O(R)),Xt=C.__importDefault(Qt());v.PostgrestClient=Xt.default;var Zt=C.__importDefault(ct());v.PostgrestQueryBuilder=Zt.default;var te=C.__importDefault(W());v.PostgrestFilterBuilder=te.default;var ee=C.__importDefault(ot());v.PostgrestTransformBuilder=ee.default;var re=C.__importDefault(st());v.PostgrestBuilder=re.default;var se=C.__importDefault(tt());v.PostgrestError=se.default;v.default={PostgrestClient:Xt.default,PostgrestQueryBuilder:Zt.default,PostgrestFilterBuilder:te.default,PostgrestTransformBuilder:ee.default,PostgrestBuilder:re.default,PostgrestError:se.default}});var Ce={};vt(Ce,{AbortController:()=>H,AbortSignal:()=>A,AuthClient:()=>M,CURRENT_JWT_KEY:()=>P,ENTITIES_BASE_PATH:()=>oe,FILE_STORAGE_BASE_PATH:()=>Pt,GENERATE_UPLOAD_URL_PATH:()=>_t,Headers:()=>w,LOGIN_TOKEN_KEY:()=>E,LOGIN_USER_PROFILE_KEY:()=>S,NvwaCapability:()=>mt,NvwaEdgeFunctions:()=>z,NvwaFileStorage:()=>K,NvwaHttpClient:()=>G,NvwaSkill:()=>gt,OverlayManager:()=>yt,Request:()=>L,Response:()=>N,SET_AUTH_TOKEN_HEADER:()=>J,URL:()=>j,URLSearchParams:()=>$,createPostgrestClient:()=>$e,getSourceLocationFromDOM:()=>Ae,polyfill:()=>ge,requestPaymentFromOrderResult:()=>Ue});module.exports=O(Ce);u();u();var z=class{constructor(t,e=""){this.http=t,this.baseUrl=e.replace(/\/$/,"")}async invoke(t,e){let r=this.baseUrl?`${this.baseUrl}/functions/${t}`:`/functions/${t}`;return await(await this.http.fetch(r,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};u();u();var P="nvwa_current_jwt",E="nvwa_login_token",S="nvwa_user_profile",J="set-auth-token",pe=typeof fetch<"u"?(n,t)=>fetch(n,t):()=>{throw new Error("AuthClient requires fetch")},M=class{constructor(t,e={}){this.baseUrl=t.replace(/\/$/,""),this.authPath=(e.authPath??"/auth").replace(/^\//,""),this.fetchImpl=e.fetchImpl??pe,this.storage=e.storage??null,this.credentials=e.credentials??"omit",typeof console<"u"&&(console.warn("[NvwaAuth] init baseUrl:",this.baseUrl||"(empty)"),(!this.baseUrl||!this.baseUrl.startsWith("http://")&&!this.baseUrl.startsWith("https://"))&&console.warn("[NvwaAuth] baseUrl \u5E94\u4E3A\u5B8C\u6574\u5730\u5740\uFF08\u5982 https://xxx.nvwa.app\uFF09\uFF0C\u5426\u5219\u5C0F\u7A0B\u5E8F request \u4F1A\u62A5 invalid url"))}async currentUser(){if(this.storage){let r=await this.storage.get(S);if(r!=null)return r}let{data:t}=await this.getSession(),e=t?.user??null;return e&&this.storage&&await this.storage.set(S,e),e}async getCurrentJwt(){if(this.storage){let e=await this.storage.get(P);if(e!=null)return e;let r=await this.storage.get(E),{data:s}=await this.getToken(r??void 0);return s?.token?(await this.storage.set(P,s.token),s.token):null}let{data:t}=await this.getToken();return t?.token??null}async persistLogin(t,e){if(!this.storage)return;let s=e?.headers.get(J)?.trim()||t.token||t.session?.token;s&&await this.storage.set(E,s),t.user&&await this.storage.set(S,t.user);let i=s??await this.storage.get(E),{data:o}=await this.getToken(i??void 0);o?.token&&await this.storage.set(P,o.token)}async clearLogin(){this.storage&&(await this.storage.remove(E),await this.storage.remove(S),await this.storage.remove(P))}url(t){let r=`${`${this.baseUrl.replace(/\/+$/,"")}/${this.authPath.replace(/^\/+/,"")}`}/${t.replace(/^\/+/,"")}`;return typeof console<"u"&&(console.warn("[NvwaAuth] request URL:",r),!r.startsWith("http://")&&!r.startsWith("https://")&&console.warn("[NvwaAuth] URL \u975E\u5B8C\u6574\u5730\u5740\uFF0C\u5C0F\u7A0B\u5E8F\u4F1A\u62A5 invalid url\uFF0C\u8BF7\u68C0\u67E5 Nvwa \u6784\u9020\u65F6\u4F20\u5165\u7684 baseUrl")),r}async getSession(){try{let t={};if(this.storage){let s=await this.storage.get(E)??await this.storage.get(P);s!=null&&(t.Authorization=`Bearer ${s}`)}let e=await this.fetchImpl(this.url("session"),{method:"GET",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return e.ok?{data:await e.json()}:{data:null,error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{data:null,error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signInWithEmail(t,e){try{let r=await this.fetchImpl(this.url("sign-in/email"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify({email:t,password:e})}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return i&&await this.persistLogin({user:i.user,session:i.session},r),{data:i}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async signOut(){try{let t={};if(this.storage){let r=await this.storage.get(E)??await this.storage.get(P);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("sign-out"),{method:"POST",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return await this.clearLogin(),e.ok?{}:{error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signUp(t){let e=await this.postJson("sign-up/email",t);return e.data&&await this.persistLogin(e.data,e.response),e}async getToken(t){try{let e={};if(t)e.Authorization=`Bearer ${t}`;else if(this.storage){let o=await this.storage.get(E)??await this.storage.get(P);o!=null&&(e.Authorization=`Bearer ${o}`)}let r=await this.fetchImpl(this.url("token"),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return{data:i?.token!=null?{token:i.token}:void 0}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async signInWithUsername(t,e){let r=await this.postJson("sign-in/username",{username:t,password:e});return r.data&&await this.persistLogin(r.data,r.response),r}async signInWithPhoneNumber(t,e,r){let s=await this.postJson("sign-in/phone-number",{phoneNumber:t,password:e,rememberMe:r});return s.data&&await this.persistLogin(s.data,s.response),s}async sendPhoneNumberOtp(t){let e=await this.postJson("phone-number/send-otp",{phoneNumber:t});return e.error?{error:e.error}:{}}async verifyPhoneNumber(t,e){let r=await this.postJson("phone-number/verify",{phoneNumber:t,code:e});return r.data&&await this.persistLogin(r.data,r.response),r}async loginWithWeChatCode(t,e){try{let r={"Content-Type":"application/json"};if(this.storage){let a=await this.storage.get(P);a!=null&&(r.Authorization=`Bearer ${a}`)}let s=await this.fetchImpl(this.url("wechat/openplatform/sign-in"),{method:"POST",headers:r,credentials:this.credentials,body:JSON.stringify({code:t,applicationCode:e})}),i=await s.text();if(!s.ok)return{error:{message:i||s.statusText,status:s.status}};let o=i?JSON.parse(i):null;return!o?.token||!o.user?{error:{message:"invalid_wechat_login_response",status:502}}:(this.storage&&(await this.storage.set(P,o.token),await this.storage.set(E,o.token),await this.storage.set(S,o.user)),{data:o})}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async getWeChatOpenPlatformIdentity(t){try{let e={};if(this.storage){let a=await this.storage.get(P);a!=null&&(e.Authorization=`Bearer ${a}`)}let r=t?.trim()?`?appId=${encodeURIComponent(t.trim())}`:"",s=await this.fetchImpl(this.url(`wechat/openplatform/identity${r}`),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),i=await s.text();if(!s.ok)return{error:{message:i||s.statusText,status:s.status}};let o=i?JSON.parse(i):null;return!o?.openid||!o.appId?{error:{message:"invalid_wechat_identity_response",status:502}}:{data:o}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async postJson(t,e){try{let r=await this.fetchImpl(this.url(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify(e)}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return{data:i?.data??i??void 0,response:r}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}};u();u();var w=class n{constructor(t){this.headerMap=new Map;if(t){if(t instanceof n)t.forEach((e,r)=>this.set(r,e));else if(Array.isArray(t))for(let[e,r]of t)this.set(e,String(r));else if(typeof t=="object")for(let e of Object.keys(t))this.set(e,String(t[e]))}}append(t,e){let r=t.toLowerCase(),s=this.headerMap.get(r);this.headerMap.set(r,s?`${s}, ${e}`:e)}set(t,e){this.headerMap.set(t.toLowerCase(),String(e))}get(t){let e=this.headerMap.get(t.toLowerCase());return e??null}has(t){return this.headerMap.has(t.toLowerCase())}delete(t){this.headerMap.delete(t.toLowerCase())}forEach(t){for(let[e,r]of this.headerMap.entries())t(r,e,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},$=class n{constructor(t){this.params=new Map;if(t){if(typeof t=="string")this.parseString(t);else if(t instanceof n)this.params=new Map(t.params);else if(Array.isArray(t))for(let[e,r]of t)this.append(e,r);else if(t&&typeof t=="object")for(let[e,r]of Object.entries(t))this.set(e,r)}}parseString(t){t.startsWith("?")&&(t=t.slice(1));let e=t.split("&");for(let r of e)if(r){let[s,i]=r.split("=");s&&this.append(decodeURIComponent(s),i?decodeURIComponent(i):"")}}append(t,e){let r=this.params.get(t)||[];r.push(e),this.params.set(t,r)}delete(t){this.params.delete(t)}get(t){let e=this.params.get(t);return e?e[0]:null}getAll(t){return this.params.get(t)||[]}has(t){return this.params.has(t)}set(t,e){this.params.set(t,[e])}sort(){let t=Array.from(this.params.entries()).sort(([e],[r])=>e.localeCompare(r));this.params=new Map(t)}toString(){let t=[];for(let[e,r]of this.params.entries())for(let s of r)t.push(`${encodeURIComponent(e)}=${encodeURIComponent(s)}`);return t.join("&")}forEach(t){for(let[e,r]of this.params.entries())for(let s of r)t(s,e,this)}keys(){return this.params.keys()}values(){let t=[];for(let e of this.params.values())t.push(...e);return t[Symbol.iterator]()}entries(){let t=[];for(let[e,r]of this.params.entries())for(let s of r)t.push([e,s]);return t[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},j=class n{constructor(t,e){let r;if(t instanceof n)r=t.href;else if(e){let i=e instanceof n?e.href:e;r=this.resolve(i,t)}else r=t;let s=this.parseUrl(r);this.href=r,this.origin=`${s.protocol}//${s.host}`,this.protocol=s.protocol,this.username=s.username,this.password=s.password,this.host=s.host,this.hostname=s.hostname,this.port=s.port,this.pathname=s.pathname,this.search=s.search,this.searchParams=new $(s.search),this.hash=s.hash}resolve(t,e){if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("//"))return`${this.parseUrl(t).protocol}${e}`;if(e.startsWith("/")){let i=this.parseUrl(t);return`${i.protocol}//${i.host}${e}`}let r=this.parseUrl(t),s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return`${r.protocol}//${r.host}${s}${e}`}parseUrl(t){let e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)throw new TypeError("Invalid URL");let r=e[2]||"",s=e[4]||"",i=e[5]||"/",o=e[7]?`?${e[7]}`:"",a=e[9]?`#${e[9]}`:"";if(!r&&!s&&!i.startsWith("/")&&!i.includes("/")&&!i.includes("."))throw new TypeError("Invalid URL");let h=s.match(/^([^@]*)@(.+)$/),l="",c="",d=s;if(h){let b=h[1];d=h[2];let y=b.match(/^([^:]*):?(.*)$/);y&&(l=y[1]||"",c=y[2]||"")}let g=d.match(/^([^:]+):?(\d*)$/),p=g?g[1]:d,m=g&&g[2]?g[2]:"";return{protocol:r?`${r}:`:"",username:l,password:c,host:d,hostname:p,port:m,pathname:i,search:o,hash:a}}toString(){let t=this.searchParams.toString(),e=t?`?${t}`:"";return`${this.protocol}//${this.host}${this.pathname}${e}${this.hash}`}toJSON(){return this.toString()}};u();var L=class n{constructor(t,e){if(typeof t=="string")this.url=t;else if(t?.url)this.url=String(t.url);else if(typeof t?.toString=="function")this.url=String(t.toString());else throw new Error("Invalid input for Request");this.method=(e?.method||"GET").toUpperCase(),this.headers=e?.headers instanceof w?e.headers:new w(e?.headers),this.body=e?.body,this.timeout=e?.timeout,this.signal=e?.signal||void 0}clone(){return new n(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};u();var N=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=fe(e?.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 t=await this.text();return new TextEncoder().encode(t).buffer}};function fe(n){return n?new w(n):new w}u();var A=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 t of Array.from(this.listeners))try{t()}catch{}this.listeners.clear()}}addEventListener(t,e){if(this._aborted){try{e()}catch{}return}this.listeners.add(e)}removeEventListener(t,e){this.listeners.delete(e)}toString(){return"[object AbortSignal]"}},H=class{constructor(){this._signal=new A}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};u();function ge(n){n.URL=j,n.URLSearchParams=$,n.Headers=w,n.Request=L,n.Response=N,n.AbortController=H,n.AbortSignal=A}var G=class{constructor(t,e,r){this.storage=t,this.customFetch=e,this.handleUnauthorized=r}async fetch(t,e){return await this.customFetch(t,e)}async fetchWithAuth(t,e){let r=await this.storage.get(P),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let i=e?.method||"GET";if((i==="POST"||i==="PUT"||i==="PATCH")&&e?.body){let a=s.get("Content-Type");(!a||a.includes("text/plain"))&&s.set("Content-Type","application/json")}let o=await this.customFetch(t,{...e,headers:s});if(o.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return o}};u();var Pt="/storage",_t=Pt+"/generateUploadUrl",K=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+_t,{method:"POST",body:{fileName:t.name||t.fileName,fileSize:t.size||t.fileSize,fileType:t.type||t.fileType}}),{url:r}=await e.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:t,headers:new w({"Content-Type":t.type||t.fileType||"application/octet-stream"})}),{url:i}=await s.json();return{url:i.split("?")[0]}}};u();u();u();var ft=de(ne(),1),{PostgrestClient:ie,PostgrestQueryBuilder:Ir,PostgrestFilterBuilder:kr,PostgrestTransformBuilder:qr,PostgrestBuilder:Mr,PostgrestError:Dr}=ft.default||ft;var oe="/entities",$e=(n,t)=>new ie(n+oe,{fetch:t.fetchWithAuth.bind(t)});u();var gt=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,i=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(i.status!==200)throw new Error(i.message);return i.data}};u();var mt=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,i=await(await this.http.fetchWithAuth(r,{method:"POST",body:e!=null?JSON.stringify(e):void 0,timeout:6e5})).json();if(i.status!==200)throw new Error(i.message);return i.data}};u();var yt=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 t=document.createElement("style");t.id="__nvwa-inspector-overlay-style",t.textContent=`
|
|
1
|
+
"use strict";var ae=Object.create;var q=Object.defineProperty;var le=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var he=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var wt=(n,t)=>()=>(n&&(t=n(n=0)),t);var x=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),vt=(n,t)=>{for(var e in t)q(n,e,{get:t[e],enumerable:!0})},bt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of ue(t))!ce.call(n,s)&&s!==e&&q(n,s,{get:()=>t[s],enumerable:!(r=le(t,s))||r.enumerable});return n};var de=(n,t,e)=>(e=n!=null?ae(he(n)):{},bt(t||!n||!n.__esModule?q(e,"default",{value:n,enumerable:!0}):e,n)),O=n=>bt(q({},"__esModule",{value:!0}),n);var u=wt(()=>{"use strict"});var R={};vt(R,{__addDisposableResource:()=>Gt,__assign:()=>D,__asyncDelegator:()=>qt,__asyncGenerator:()=>kt,__asyncValues:()=>Mt,__await:()=>U,__awaiter:()=>Ct,__classPrivateFieldGet:()=>Wt,__classPrivateFieldIn:()=>Jt,__classPrivateFieldSet:()=>zt,__createBinding:()=>F,__decorate:()=>Ot,__disposeResources:()=>Kt,__esDecorate:()=>Rt,__exportStar:()=>Lt,__extends:()=>Et,__generator:()=>jt,__importDefault:()=>Ft,__importStar:()=>Bt,__makeTemplateObject:()=>Dt,__metadata:()=>Ut,__param:()=>St,__propKey:()=>$t,__read:()=>Q,__rest:()=>xt,__rewriteRelativeImportExtension:()=>Yt,__runInitializers:()=>Tt,__setFunctionName:()=>At,__spread:()=>Nt,__spreadArray:()=>It,__spreadArrays:()=>Ht,__values:()=>B,default:()=>we});function Et(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Y(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function xt(n,t){var e={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(e[r[s]]=n[r[s]]);return e}function Ot(n,t,e,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(s<3?o(i):s>3?o(t,e,i):o(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i}function St(n,t){return function(e,r){t(e,r,n)}}function Rt(n,t,e,r,s,i){function o(_){if(_!==void 0&&typeof _!="function")throw new TypeError("Function expected");return _}for(var a=r.kind,h=a==="getter"?"get":a==="setter"?"set":"value",l=!t&&n?r.static?n:n.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,g=!1,p=e.length-1;p>=0;p--){var m={};for(var b in r)m[b]=b==="access"?{}:r[b];for(var b in r.access)m.access[b]=r.access[b];m.addInitializer=function(_){if(g)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(_||null))};var y=(0,e[p])(a==="accessor"?{get:c.get,set:c.set}:c[h],m);if(a==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(d=o(y.get))&&(c.get=d),(d=o(y.set))&&(c.set=d),(d=o(y.init))&&s.unshift(d)}else(d=o(y))&&(a==="field"?s.unshift(d):c[h]=d)}l&&Object.defineProperty(l,r.name,c),g=!0}function Tt(n,t,e){for(var r=arguments.length>2,s=0;s<t.length;s++)e=r?t[s].call(n,e):t[s].call(n);return r?e:void 0}function $t(n){return typeof n=="symbol"?n:"".concat(n)}function At(n,t,e){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(n,"name",{configurable:!0,value:e?"".concat(e," ",t):t})}function Ut(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)}function Ct(n,t,e,r){function s(i){return i instanceof e?i:new e(function(o){o(i)})}return new(e||(e=Promise))(function(i,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function h(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?i(c.value):s(c.value).then(a,h)}l((r=r.apply(n,t||[])).next())})}function jt(n,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(r=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){e.label=l[1];break}if(l[0]===6&&e.label<i[1]){e.label=i[1],i=l;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(l);break}i[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],s=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Lt(n,t){for(var e in n)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&F(t,n,e)}function B(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],r=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Q(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var r=e.call(n),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(o)throw o.error}}return i}function Nt(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(Q(arguments[t]));return n}function Ht(){for(var n=0,t=0,e=arguments.length;t<e;t++)n+=arguments[t].length;for(var r=Array(n),s=0,t=0;t<e;t++)for(var i=arguments[t],o=0,a=i.length;o<a;o++,s++)r[s]=i[o];return r}function It(n,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return n.concat(i||Array.prototype.slice.call(t))}function U(n){return this instanceof U?(this.v=n,this):new U(n)}function kt(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(n,t||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(p){return function(m){return Promise.resolve(m).then(p,d)}}function a(p,m){r[p]&&(s[p]=function(b){return new Promise(function(y,_){i.push([p,b,y,_])>1||h(p,b)})},m&&(s[p]=m(s[p])))}function h(p,m){try{l(r[p](m))}catch(b){g(i[0][3],b)}}function l(p){p.value instanceof U?Promise.resolve(p.value.v).then(c,d):g(i[0][2],p)}function c(p){h("next",p)}function d(p){h("throw",p)}function g(p,m){p(m),i.shift(),i.length&&h(i[0][0],i[0][1])}}function qt(n){var t,e;return t={},r("next"),r("throw",function(s){throw s}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(s,i){t[s]=n[s]?function(o){return(e=!e)?{value:U(n[s](o)),done:!1}:i?i(o):o}:i}}function Mt(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n[Symbol.asyncIterator],e;return t?t.call(n):(n=typeof B=="function"?B(n):n[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(i){e[i]=n[i]&&function(o){return new Promise(function(a,h){o=n[i](o),s(a,h,o.done,o.value)})}}function s(i,o,a,h){Promise.resolve(h).then(function(l){i({value:l,done:a})},o)}}function Dt(n,t){return Object.defineProperty?Object.defineProperty(n,"raw",{value:t}):n.raw=t,n}function Bt(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e=V(n),r=0;r<e.length;r++)e[r]!=="default"&&F(t,n,e[r]);return me(t,n),t}function Ft(n){return n&&n.__esModule?n:{default:n}}function Wt(n,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(n):r?r.value:t.get(n)}function zt(n,t,e,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,e):s?s.value=e:t.set(n,e),e}function Jt(n,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?t===n:n.has(t)}function Gt(n,t,e){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var r,s;if(e){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],e&&(s=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),n.stack.push({value:t,dispose:r,async:e})}else e&&n.stack.push({async:!0});return t}function Kt(n){function t(i){n.error=n.hasError?new ye(i,n.error,"An error was suppressed during disposal."):i,n.hasError=!0}var e,r=0;function s(){for(;e=n.stack.pop();)try{if(!e.async&&r===1)return r=0,n.stack.push(e),Promise.resolve().then(s);if(e.dispose){var i=e.dispose.call(e.value);if(e.async)return r|=2,Promise.resolve(i).then(s,function(o){return t(o),s()})}else r|=1}catch(o){t(o)}if(r===1)return n.hasError?Promise.reject(n.error):Promise.resolve();if(n.hasError)throw n.error}return s()}function Yt(n,t){return typeof n=="string"&&/^\.\.?\//.test(n)?n.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,s,i,o){return r?t?".jsx":".js":s&&(!i||!o)?e:s+i+"."+o.toLowerCase()+"js"}):n}var Y,D,F,me,V,ye,we,T=wt(()=>{"use strict";u();Y=function(n,t){return Y=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},Y(n,t)};D=function(){return D=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},D.apply(this,arguments)};F=Object.create?(function(n,t,e,r){r===void 0&&(r=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,r,s)}):(function(n,t,e,r){r===void 0&&(r=e),n[r]=t[e]});me=Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t},V=function(n){return V=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},V(n)};ye=typeof SuppressedError=="function"?SuppressedError:function(n,t,e){var r=new Error(e);return r.name="SuppressedError",r.error=n,r.suppressed=t,r};we={__extends:Et,__assign:D,__rest:xt,__decorate:Ot,__param:St,__esDecorate:Rt,__runInitializers:Tt,__propKey:$t,__setFunctionName:At,__metadata:Ut,__awaiter:Ct,__generator:jt,__createBinding:F,__exportStar:Lt,__values:B,__read:Q,__spread:Nt,__spreadArrays:Ht,__spreadArray:It,__await:U,__asyncGenerator:kt,__asyncDelegator:qt,__asyncValues:Mt,__makeTemplateObject:Dt,__importStar:Bt,__importDefault:Ft,__classPrivateFieldGet:Wt,__classPrivateFieldSet:zt,__classPrivateFieldIn:Jt,__addDisposableResource:Gt,__disposeResources:Kt,__rewriteRelativeImportExtension:Yt}});var tt=x(Z=>{"use strict";u();Object.defineProperty(Z,"__esModule",{value:!0});var X=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}};Z.default=X});var st=x(rt=>{"use strict";u();Object.defineProperty(rt,"__esModule",{value:!0});var ve=(T(),O(R)),be=ve.__importDefault(tt()),et=class{constructor(t){var e,r;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){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,s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,a,h,l;let c=null,d=null,g=null,p=i.status,m=i.statusText;if(i.ok){if(this.method!=="HEAD"){let k=await i.text();k===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?d=k:d=JSON.parse(k))}let y=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),_=(h=i.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");y&&_&&_.length>1&&(g=parseInt(_[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(c={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,g=null,p=406,m="Not Acceptable"):d.length===1?d=d[0]:d=null)}else{let y=await i.text();try{c=JSON.parse(y),Array.isArray(c)&&i.status===404&&(d=[],c=null,p=200,m="OK")}catch{i.status===404&&y===""?(p=204,m="No Content"):c={message:y}}if(c&&this.isMaybeSingle&&(!((l=c?.details)===null||l===void 0)&&l.includes("0 rows"))&&(c=null,p=200,m="OK"),c&&this.shouldThrowOnError)throw new be.default(c)}return{error:c,data:d,count:g,status:p,statusText:m}});return this.shouldThrowOnError||(s=s.catch(i=>{var o,a,h;return{error:{message:`${(o=i?.name)!==null&&o!==void 0?o:"FetchError"}: ${i?.message}`,details:`${(a=i?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(h=i?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),s.then(t,e)}returns(){return this}overrideTypes(){return this}};rt.default=et});var ot=x(it=>{"use strict";u();Object.defineProperty(it,"__esModule",{value:!0});var Pe=(T(),O(R)),_e=Pe.__importDefault(st()),nt=class extends _e.default{select(t){let e=!1,r=(t??"*").split("").map(s=>/\s/.test(s)&&!e?"":(s==='"'&&(e=!e),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:s,referencedTable:i=s}={}){let o=i?`${i}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){let s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:s=r}={}){let i=typeof s>"u"?"offset":`${s}.offset`,o=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(o,`${e-t+1}`),this}abortSignal(t){return this.signal=t,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:t=!1,verbose:e=!1,settings:r=!1,buffers:s=!1,wal:i=!1,format:o="text"}={}){var a;let h=[t?"analyze":null,e?"verbose":null,r?"settings":null,s?"buffers":null,i?"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+${o}; for="${l}"; options=${h};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};it.default=nt});var W=x(lt=>{"use strict";u();Object.defineProperty(lt,"__esModule",{value:!0});var Ee=(T(),O(R)),xe=Ee.__importDefault(ot()),Oe=new RegExp("[,()]"),at=class extends xe.default{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}in(t,e){let r=Array.from(new Set(e)).map(s=>typeof s=="string"&&Oe.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:s}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");let o=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${i}fts${o}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){let s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}};lt.default=at});var ct=x(ht=>{"use strict";u();Object.defineProperty(ht,"__esModule",{value:!0});var Se=(T(),O(R)),I=Se.__importDefault(W()),ut=class{constructor(t,{headers:e={},schema:r,fetch:s}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=s}select(t,e){let{head:r=!1,count:s}=e??{},i=r?"HEAD":"GET",o=!1,a=(t??"*").split("").map(h=>/\s/.test(h)&&!o?"":(h==='"'&&(o=!o),h)).join("");return this.url.searchParams.set("select",a),s&&this.headers.append("Prefer",`count=${s}`),new I.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:r=!0}={}){var s;let i="POST";if(e&&this.headers.append("Prefer",`count=${e}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let o=t.reduce((a,h)=>a.concat(Object.keys(h)),[]);if(o.length>0){let a=[...new Set(o)].map(h=>`"${h}"`);this.url.searchParams.set("columns",a.join(","))}}return new I.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:s,defaultToNull:i=!0}={}){var o;let a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),s&&this.headers.append("Prefer",`count=${s}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let h=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(h.length>0){let l=[...new Set(h)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new I.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(t,{count:e}={}){var r;let s="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new I.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:t}={}){var e;let r="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new I.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}};ht.default=ut});var Qt=x(pt=>{"use strict";u();Object.defineProperty(pt,"__esModule",{value:!0});var Vt=(T(),O(R)),Re=Vt.__importDefault(ct()),Te=Vt.__importDefault(W()),dt=class n{constructor(t,{headers:e={},schema:r,fetch:s}={}){this.url=t,this.headers=new Headers(e),this.schemaName=r,this.fetch=s}from(t){let e=new URL(`${this.url}/${t}`);return new Re.default(e,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new n(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,e={},{head:r=!1,get:s=!1,count:i}={}){var o;let a,h=new URL(`${this.url}/rpc/${t}`),l;r||s?(a=r?"HEAD":"GET",Object.entries(e).filter(([d,g])=>g!==void 0).map(([d,g])=>[d,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([d,g])=>{h.searchParams.append(d,g)})):(a="POST",l=e);let c=new Headers(this.headers);return i&&c.set("Prefer",`count=${i}`),new Te.default({method:a,url:h,headers:c,schema:this.schemaName,body:l,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};pt.default=dt});var ne=x(v=>{"use strict";u();Object.defineProperty(v,"__esModule",{value:!0});v.PostgrestError=v.PostgrestBuilder=v.PostgrestTransformBuilder=v.PostgrestFilterBuilder=v.PostgrestQueryBuilder=v.PostgrestClient=void 0;var C=(T(),O(R)),Xt=C.__importDefault(Qt());v.PostgrestClient=Xt.default;var Zt=C.__importDefault(ct());v.PostgrestQueryBuilder=Zt.default;var te=C.__importDefault(W());v.PostgrestFilterBuilder=te.default;var ee=C.__importDefault(ot());v.PostgrestTransformBuilder=ee.default;var re=C.__importDefault(st());v.PostgrestBuilder=re.default;var se=C.__importDefault(tt());v.PostgrestError=se.default;v.default={PostgrestClient:Xt.default,PostgrestQueryBuilder:Zt.default,PostgrestFilterBuilder:te.default,PostgrestTransformBuilder:ee.default,PostgrestBuilder:re.default,PostgrestError:se.default}});var Ce={};vt(Ce,{AbortController:()=>H,AbortSignal:()=>A,AuthClient:()=>M,CURRENT_JWT_KEY:()=>P,ENTITIES_BASE_PATH:()=>oe,FILE_STORAGE_BASE_PATH:()=>Pt,GENERATE_UPLOAD_URL_PATH:()=>_t,Headers:()=>w,LOGIN_TOKEN_KEY:()=>E,LOGIN_USER_PROFILE_KEY:()=>S,NvwaCapability:()=>mt,NvwaEdgeFunctions:()=>z,NvwaFileStorage:()=>K,NvwaHttpClient:()=>G,NvwaSkill:()=>gt,OverlayManager:()=>yt,Request:()=>L,Response:()=>N,SET_AUTH_TOKEN_HEADER:()=>J,URL:()=>j,URLSearchParams:()=>$,createPostgrestClient:()=>$e,getSourceLocationFromDOM:()=>Ae,polyfill:()=>ge,requestPaymentFromOrderResult:()=>Ue});module.exports=O(Ce);u();u();var z=class{constructor(t,e=""){this.http=t,this.baseUrl=e.replace(/\/$/,"")}async invoke(t,e){let r=this.baseUrl?`${this.baseUrl}/functions/${t}`:`/functions/${t}`;return await(await this.http.fetch(r,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};u();u();var P="nvwa_current_jwt",E="nvwa_login_token",S="nvwa_user_profile",J="set-auth-token",pe=typeof fetch<"u"?(n,t)=>fetch(n,t):()=>{throw new Error("AuthClient requires fetch")},M=class{constructor(t,e={}){this.baseUrl=t.replace(/\/$/,""),this.authPath=(e.authPath??"/auth").replace(/^\//,""),this.fetchImpl=e.fetchImpl??pe,this.storage=e.storage??null,this.credentials=e.credentials??"omit",typeof console<"u"&&(console.warn("[NvwaAuth] init baseUrl:",this.baseUrl||"(empty)"),(!this.baseUrl||!this.baseUrl.startsWith("http://")&&!this.baseUrl.startsWith("https://"))&&console.warn("[NvwaAuth] baseUrl \u5E94\u4E3A\u5B8C\u6574\u5730\u5740\uFF08\u5982 https://xxx.nvwa.app\uFF09\uFF0C\u5426\u5219\u5C0F\u7A0B\u5E8F request \u4F1A\u62A5 invalid url"))}async currentUser(){if(this.storage){let r=await this.storage.get(S);if(r!=null)return r}let{data:t}=await this.getSession(),e=t?.user??null;return e&&this.storage&&await this.storage.set(S,e),e}async getCurrentJwt(){if(this.storage){let e=await this.storage.get(P);if(e!=null)return e;let r=await this.storage.get(E),{data:s}=await this.getToken(r??void 0);return s?.token?(await this.storage.set(P,s.token),s.token):null}let{data:t}=await this.getToken();return t?.token??null}async persistLogin(t,e){if(!this.storage)return;let s=e?.headers.get(J)?.trim()||t.token||t.session?.token;s&&await this.storage.set(E,s),t.user&&await this.storage.set(S,t.user);let i=s??await this.storage.get(E),{data:o}=await this.getToken(i??void 0);o?.token&&await this.storage.set(P,o.token)}async clearLogin(){this.storage&&(await this.storage.remove(E),await this.storage.remove(S),await this.storage.remove(P))}url(t){let r=`${`${this.baseUrl.replace(/\/+$/,"")}/${this.authPath.replace(/^\/+/,"")}`}/${t.replace(/^\/+/,"")}`;return typeof console<"u"&&(console.warn("[NvwaAuth] request URL:",r),!r.startsWith("http://")&&!r.startsWith("https://")&&console.warn("[NvwaAuth] URL \u975E\u5B8C\u6574\u5730\u5740\uFF0C\u5C0F\u7A0B\u5E8F\u4F1A\u62A5 invalid url\uFF0C\u8BF7\u68C0\u67E5 Nvwa \u6784\u9020\u65F6\u4F20\u5165\u7684 baseUrl")),r}async getSession(){try{let t={};if(this.storage){let s=await this.storage.get(E)??await this.storage.get(P);s!=null&&(t.Authorization=`Bearer ${s}`)}let e=await this.fetchImpl(this.url("session"),{method:"GET",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return e.ok?{data:await e.json()}:{data:null,error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{data:null,error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signInWithEmail(t,e){try{let r=await this.fetchImpl(this.url("sign-in/email"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify({email:t,password:e})}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return i&&await this.persistLogin({user:i.user,session:i.session},r),{data:i}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async signOut(){try{let t={};if(this.storage){let r=await this.storage.get(E)??await this.storage.get(P);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("sign-out"),{method:"POST",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return await this.clearLogin(),e.ok?{}:{error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signUp(t){let e=await this.postJson("sign-up/email",t);return e.data&&await this.persistLogin(e.data,e.response),e}async getToken(t){try{let e={};if(t)e.Authorization=`Bearer ${t}`;else if(this.storage){let o=await this.storage.get(E)??await this.storage.get(P);o!=null&&(e.Authorization=`Bearer ${o}`)}let r=await this.fetchImpl(this.url("token"),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return{data:i?.token!=null?{token:i.token}:void 0}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async signInWithUsername(t,e){let r=await this.postJson("sign-in/username",{username:t,password:e});return r.data&&await this.persistLogin(r.data,r.response),r}async signInWithPhoneNumber(t,e,r){let s=await this.postJson("sign-in/phone-number",{phoneNumber:t,password:e,rememberMe:r});return s.data&&await this.persistLogin(s.data,s.response),s}async sendPhoneNumberOtp(t){let e=await this.postJson("phone-number/send-otp",{phoneNumber:t});return e.error?{error:e.error}:{}}async verifyPhoneNumber(t,e){let r=await this.postJson("phone-number/verify",{phoneNumber:t,code:e});return r.data&&await this.persistLogin(r.data,r.response),r}async loginWithWeChatCode(t,e){try{let r={"Content-Type":"application/json"};if(this.storage){let a=await this.storage.get(P);a!=null&&(r.Authorization=`Bearer ${a}`)}let s=await this.fetchImpl(this.url("wechat/openplatform/sign-in"),{method:"POST",headers:r,credentials:this.credentials,body:JSON.stringify({code:t,applicationCode:e})}),i=await s.text();if(!s.ok)return{error:{message:i||s.statusText,status:s.status}};let o=i?JSON.parse(i):null;return!o?.token||!o.user?{error:{message:"invalid_wechat_login_response",status:502}}:(this.storage&&(await this.storage.set(P,o.token),await this.storage.set(E,o.token),await this.storage.set(S,o.user)),{data:o})}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async getWeChatOpenPlatformIdentity(t){try{let e={};if(this.storage){let a=await this.storage.get(P);a!=null&&(e.Authorization=`Bearer ${a}`)}let r=t?.trim()?`?applicationCode=${encodeURIComponent(t.trim())}`:"",s=await this.fetchImpl(this.url(`wechat/openplatform/identity${r}`),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),i=await s.text();if(!s.ok)return{error:{message:i||s.statusText,status:s.status}};let o=i?JSON.parse(i):null;return!o?.openid||!o.appId?{error:{message:"invalid_wechat_identity_response",status:502}}:{data:o}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async postJson(t,e){try{let r=await this.fetchImpl(this.url(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify(e)}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return{data:i?.data??i??void 0,response:r}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}};u();u();var w=class n{constructor(t){this.headerMap=new Map;if(t){if(t instanceof n)t.forEach((e,r)=>this.set(r,e));else if(Array.isArray(t))for(let[e,r]of t)this.set(e,String(r));else if(typeof t=="object")for(let e of Object.keys(t))this.set(e,String(t[e]))}}append(t,e){let r=t.toLowerCase(),s=this.headerMap.get(r);this.headerMap.set(r,s?`${s}, ${e}`:e)}set(t,e){this.headerMap.set(t.toLowerCase(),String(e))}get(t){let e=this.headerMap.get(t.toLowerCase());return e??null}has(t){return this.headerMap.has(t.toLowerCase())}delete(t){this.headerMap.delete(t.toLowerCase())}forEach(t){for(let[e,r]of this.headerMap.entries())t(r,e,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},$=class n{constructor(t){this.params=new Map;if(t){if(typeof t=="string")this.parseString(t);else if(t instanceof n)this.params=new Map(t.params);else if(Array.isArray(t))for(let[e,r]of t)this.append(e,r);else if(t&&typeof t=="object")for(let[e,r]of Object.entries(t))this.set(e,r)}}parseString(t){t.startsWith("?")&&(t=t.slice(1));let e=t.split("&");for(let r of e)if(r){let[s,i]=r.split("=");s&&this.append(decodeURIComponent(s),i?decodeURIComponent(i):"")}}append(t,e){let r=this.params.get(t)||[];r.push(e),this.params.set(t,r)}delete(t){this.params.delete(t)}get(t){let e=this.params.get(t);return e?e[0]:null}getAll(t){return this.params.get(t)||[]}has(t){return this.params.has(t)}set(t,e){this.params.set(t,[e])}sort(){let t=Array.from(this.params.entries()).sort(([e],[r])=>e.localeCompare(r));this.params=new Map(t)}toString(){let t=[];for(let[e,r]of this.params.entries())for(let s of r)t.push(`${encodeURIComponent(e)}=${encodeURIComponent(s)}`);return t.join("&")}forEach(t){for(let[e,r]of this.params.entries())for(let s of r)t(s,e,this)}keys(){return this.params.keys()}values(){let t=[];for(let e of this.params.values())t.push(...e);return t[Symbol.iterator]()}entries(){let t=[];for(let[e,r]of this.params.entries())for(let s of r)t.push([e,s]);return t[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},j=class n{constructor(t,e){let r;if(t instanceof n)r=t.href;else if(e){let i=e instanceof n?e.href:e;r=this.resolve(i,t)}else r=t;let s=this.parseUrl(r);this.href=r,this.origin=`${s.protocol}//${s.host}`,this.protocol=s.protocol,this.username=s.username,this.password=s.password,this.host=s.host,this.hostname=s.hostname,this.port=s.port,this.pathname=s.pathname,this.search=s.search,this.searchParams=new $(s.search),this.hash=s.hash}resolve(t,e){if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("//"))return`${this.parseUrl(t).protocol}${e}`;if(e.startsWith("/")){let i=this.parseUrl(t);return`${i.protocol}//${i.host}${e}`}let r=this.parseUrl(t),s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return`${r.protocol}//${r.host}${s}${e}`}parseUrl(t){let e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)throw new TypeError("Invalid URL");let r=e[2]||"",s=e[4]||"",i=e[5]||"/",o=e[7]?`?${e[7]}`:"",a=e[9]?`#${e[9]}`:"";if(!r&&!s&&!i.startsWith("/")&&!i.includes("/")&&!i.includes("."))throw new TypeError("Invalid URL");let h=s.match(/^([^@]*)@(.+)$/),l="",c="",d=s;if(h){let b=h[1];d=h[2];let y=b.match(/^([^:]*):?(.*)$/);y&&(l=y[1]||"",c=y[2]||"")}let g=d.match(/^([^:]+):?(\d*)$/),p=g?g[1]:d,m=g&&g[2]?g[2]:"";return{protocol:r?`${r}:`:"",username:l,password:c,host:d,hostname:p,port:m,pathname:i,search:o,hash:a}}toString(){let t=this.searchParams.toString(),e=t?`?${t}`:"";return`${this.protocol}//${this.host}${this.pathname}${e}${this.hash}`}toJSON(){return this.toString()}};u();var L=class n{constructor(t,e){if(typeof t=="string")this.url=t;else if(t?.url)this.url=String(t.url);else if(typeof t?.toString=="function")this.url=String(t.toString());else throw new Error("Invalid input for Request");this.method=(e?.method||"GET").toUpperCase(),this.headers=e?.headers instanceof w?e.headers:new w(e?.headers),this.body=e?.body,this.timeout=e?.timeout,this.signal=e?.signal||void 0}clone(){return new n(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};u();var N=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=fe(e?.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 t=await this.text();return new TextEncoder().encode(t).buffer}};function fe(n){return n?new w(n):new w}u();var A=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 t of Array.from(this.listeners))try{t()}catch{}this.listeners.clear()}}addEventListener(t,e){if(this._aborted){try{e()}catch{}return}this.listeners.add(e)}removeEventListener(t,e){this.listeners.delete(e)}toString(){return"[object AbortSignal]"}},H=class{constructor(){this._signal=new A}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};u();function ge(n){n.URL=j,n.URLSearchParams=$,n.Headers=w,n.Request=L,n.Response=N,n.AbortController=H,n.AbortSignal=A}var G=class{constructor(t,e,r){this.storage=t,this.customFetch=e,this.handleUnauthorized=r}async fetch(t,e){return await this.customFetch(t,e)}async fetchWithAuth(t,e){let r=await this.storage.get(P),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let i=e?.method||"GET";if((i==="POST"||i==="PUT"||i==="PATCH")&&e?.body){let a=s.get("Content-Type");(!a||a.includes("text/plain"))&&s.set("Content-Type","application/json")}let o=await this.customFetch(t,{...e,headers:s});if(o.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return o}};u();var Pt="/storage",_t=Pt+"/generateUploadUrl",K=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+_t,{method:"POST",body:{fileName:t.name||t.fileName,fileSize:t.size||t.fileSize,fileType:t.type||t.fileType}}),{url:r}=await e.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:t,headers:new w({"Content-Type":t.type||t.fileType||"application/octet-stream"})}),{url:i}=await s.json();return{url:i.split("?")[0]}}};u();u();u();var ft=de(ne(),1),{PostgrestClient:ie,PostgrestQueryBuilder:Ir,PostgrestFilterBuilder:kr,PostgrestTransformBuilder:qr,PostgrestBuilder:Mr,PostgrestError:Dr}=ft.default||ft;var oe="/entities",$e=(n,t)=>new ie(n+oe,{fetch:t.fetchWithAuth.bind(t)});u();var gt=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,i=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(i.status!==200)throw new Error(i.message);return i.data}};u();var mt=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,i=await(await this.http.fetchWithAuth(r,{method:"POST",body:e!=null?JSON.stringify(e):void 0,timeout:6e5})).json();if(i.status!==200)throw new Error(i.message);return i.data}};u();var yt=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 t=document.createElement("style");t.id="__nvwa-inspector-overlay-style",t.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 ne=Object.create;var H=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var dt=(n,t)=>()=>(n&&(t=n(n=0)),t);var O=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),ue=(n,t)=>{for(var e in t)H(n,e,{get:t[e],enumerable:!0})},pt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of oe(t))!le.call(n,s)&&s!==e&&H(n,s,{get:()=>t[s],enumerable:!(r=ie(t,s))||r.enumerable});return n};var he=(n,t,e)=>(e=n!=null?ne(ae(n)):{},pt(t||!n||!n.__esModule?H(e,"default",{value:n,enumerable:!0}):e,n)),T=n=>pt(H({},"__esModule",{value:!0}),n);import Ue from"path";import{fileURLToPath as je}from"url";var u=dt(()=>{"use strict"});var S={};ue(S,{__addDisposableResource:()=>Bt,__assign:()=>D,__asyncDelegator:()=>Lt,__asyncGenerator:()=>jt,__asyncValues:()=>Nt,__await:()=>A,__awaiter:()=>Rt,__classPrivateFieldGet:()=>qt,__classPrivateFieldIn:()=>Dt,__classPrivateFieldSet:()=>Mt,__createBinding:()=>F,__decorate:()=>bt,__disposeResources:()=>Ft,__esDecorate:()=>_t,__exportStar:()=>$t,__extends:()=>wt,__generator:()=>Tt,__importDefault:()=>kt,__importStar:()=>It,__makeTemplateObject:()=>Ht,__metadata:()=>St,__param:()=>Pt,__propKey:()=>xt,__read:()=>K,__rest:()=>vt,__rewriteRelativeImportExtension:()=>Wt,__runInitializers:()=>Et,__setFunctionName:()=>Ot,__spread:()=>At,__spreadArray:()=>Ct,__spreadArrays:()=>Ut,__values:()=>B,default:()=>ye});function wt(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");J(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function vt(n,t){var e={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(e[r[s]]=n[r[s]]);return e}function bt(n,t,e,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(s<3?o(i):s>3?o(t,e,i):o(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i}function Pt(n,t){return function(e,r){t(e,r,n)}}function _t(n,t,e,r,s,i){function o(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var a=r.kind,h=a==="getter"?"get":a==="setter"?"set":"value",l=!t&&n?r.static?n:n.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,m=!1,p=e.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(E){if(m)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(E||null))};var w=(0,e[p])(a==="accessor"?{get:c.get,set:c.set}:c[h],y);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(d=o(w.get))&&(c.get=d),(d=o(w.set))&&(c.set=d),(d=o(w.init))&&s.unshift(d)}else(d=o(w))&&(a==="field"?s.unshift(d):c[h]=d)}l&&Object.defineProperty(l,r.name,c),m=!0}function Et(n,t,e){for(var r=arguments.length>2,s=0;s<t.length;s++)e=r?t[s].call(n,e):t[s].call(n);return r?e:void 0}function xt(n){return typeof n=="symbol"?n:"".concat(n)}function Ot(n,t,e){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(n,"name",{configurable:!0,value:e?"".concat(e," ",t):t})}function St(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)}function Rt(n,t,e,r){function s(i){return i instanceof e?i:new e(function(o){o(i)})}return new(e||(e=Promise))(function(i,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function h(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?i(c.value):s(c.value).then(a,h)}l((r=r.apply(n,t||[])).next())})}function Tt(n,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(r=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){e.label=l[1];break}if(l[0]===6&&e.label<i[1]){e.label=i[1],i=l;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(l);break}i[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],s=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function $t(n,t){for(var e in n)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&F(t,n,e)}function B(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],r=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var r=e.call(n),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(o)throw o.error}}return i}function At(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(K(arguments[t]));return n}function Ut(){for(var n=0,t=0,e=arguments.length;t<e;t++)n+=arguments[t].length;for(var r=Array(n),s=0,t=0;t<e;t++)for(var i=arguments[t],o=0,a=i.length;o<a;o++,s++)r[s]=i[o];return r}function Ct(n,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return n.concat(i||Array.prototype.slice.call(t))}function A(n){return this instanceof A?(this.v=n,this):new A(n)}function jt(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(n,t||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(p){return function(y){return Promise.resolve(y).then(p,d)}}function a(p,y){r[p]&&(s[p]=function(b){return new Promise(function(w,E){i.push([p,b,w,E])>1||h(p,b)})},y&&(s[p]=y(s[p])))}function h(p,y){try{l(r[p](y))}catch(b){m(i[0][3],b)}}function l(p){p.value instanceof A?Promise.resolve(p.value.v).then(c,d):m(i[0][2],p)}function c(p){h("next",p)}function d(p){h("throw",p)}function m(p,y){p(y),i.shift(),i.length&&h(i[0][0],i[0][1])}}function Lt(n){var t,e;return t={},r("next"),r("throw",function(s){throw s}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(s,i){t[s]=n[s]?function(o){return(e=!e)?{value:A(n[s](o)),done:!1}:i?i(o):o}:i}}function Nt(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n[Symbol.asyncIterator],e;return t?t.call(n):(n=typeof B=="function"?B(n):n[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(i){e[i]=n[i]&&function(o){return new Promise(function(a,h){o=n[i](o),s(a,h,o.done,o.value)})}}function s(i,o,a,h){Promise.resolve(h).then(function(l){i({value:l,done:a})},o)}}function Ht(n,t){return Object.defineProperty?Object.defineProperty(n,"raw",{value:t}):n.raw=t,n}function It(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e=G(n),r=0;r<e.length;r++)e[r]!=="default"&&F(t,n,e[r]);return ge(t,n),t}function kt(n){return n&&n.__esModule?n:{default:n}}function qt(n,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(n):r?r.value:t.get(n)}function Mt(n,t,e,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,e):s?s.value=e:t.set(n,e),e}function Dt(n,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?t===n:n.has(t)}function Bt(n,t,e){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var r,s;if(e){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],e&&(s=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),n.stack.push({value:t,dispose:r,async:e})}else e&&n.stack.push({async:!0});return t}function Ft(n){function t(i){n.error=n.hasError?new me(i,n.error,"An error was suppressed during disposal."):i,n.hasError=!0}var e,r=0;function s(){for(;e=n.stack.pop();)try{if(!e.async&&r===1)return r=0,n.stack.push(e),Promise.resolve().then(s);if(e.dispose){var i=e.dispose.call(e.value);if(e.async)return r|=2,Promise.resolve(i).then(s,function(o){return t(o),s()})}else r|=1}catch(o){t(o)}if(r===1)return n.hasError?Promise.reject(n.error):Promise.resolve();if(n.hasError)throw n.error}return s()}function Wt(n,t){return typeof n=="string"&&/^\.\.?\//.test(n)?n.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,s,i,o){return r?t?".jsx":".js":s&&(!i||!o)?e:s+i+"."+o.toLowerCase()+"js"}):n}var J,D,F,ge,G,me,ye,R=dt(()=>{"use strict";u();J=function(n,t){return J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},J(n,t)};D=function(){return D=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},D.apply(this,arguments)};F=Object.create?(function(n,t,e,r){r===void 0&&(r=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,r,s)}):(function(n,t,e,r){r===void 0&&(r=e),n[r]=t[e]});ge=Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t},G=function(n){return G=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},G(n)};me=typeof SuppressedError=="function"?SuppressedError:function(n,t,e){var r=new Error(e);return r.name="SuppressedError",r.error=n,r.suppressed=t,r};ye={__extends:wt,__assign:D,__rest:vt,__decorate:bt,__param:Pt,__esDecorate:_t,__runInitializers:Et,__propKey:xt,__setFunctionName:Ot,__metadata:St,__awaiter:Rt,__generator:Tt,__createBinding:F,__exportStar:$t,__values:B,__read:K,__spread:At,__spreadArrays:Ut,__spreadArray:Ct,__await:A,__asyncGenerator:jt,__asyncDelegator:Lt,__asyncValues:Nt,__makeTemplateObject:Ht,__importStar:It,__importDefault:kt,__classPrivateFieldGet:qt,__classPrivateFieldSet:Mt,__classPrivateFieldIn:Dt,__addDisposableResource:Bt,__disposeResources:Ft,__rewriteRelativeImportExtension:Wt}});var Q=O(V=>{"use strict";u();Object.defineProperty(V,"__esModule",{value:!0});var Y=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}};V.default=Y});var tt=O(Z=>{"use strict";u();Object.defineProperty(Z,"__esModule",{value:!0});var we=(R(),T(S)),ve=we.__importDefault(Q()),X=class{constructor(t){var e,r;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){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,s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,a,h,l;let c=null,d=null,m=null,p=i.status,y=i.statusText;if(i.ok){if(this.method!=="HEAD"){let N=await i.text();N===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?d=N:d=JSON.parse(N))}let w=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),E=(h=i.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");w&&E&&E.length>1&&(m=parseInt(E[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(c={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 w=await i.text();try{c=JSON.parse(w),Array.isArray(c)&&i.status===404&&(d=[],c=null,p=200,y="OK")}catch{i.status===404&&w===""?(p=204,y="No Content"):c={message:w}}if(c&&this.isMaybeSingle&&(!((l=c?.details)===null||l===void 0)&&l.includes("0 rows"))&&(c=null,p=200,y="OK"),c&&this.shouldThrowOnError)throw new ve.default(c)}return{error:c,data:d,count:m,status:p,statusText:y}});return this.shouldThrowOnError||(s=s.catch(i=>{var o,a,h;return{error:{message:`${(o=i?.name)!==null&&o!==void 0?o:"FetchError"}: ${i?.message}`,details:`${(a=i?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(h=i?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),s.then(t,e)}returns(){return this}overrideTypes(){return this}};Z.default=X});var st=O(rt=>{"use strict";u();Object.defineProperty(rt,"__esModule",{value:!0});var be=(R(),T(S)),Pe=be.__importDefault(tt()),et=class extends Pe.default{select(t){let e=!1,r=(t??"*").split("").map(s=>/\s/.test(s)&&!e?"":(s==='"'&&(e=!e),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:s,referencedTable:i=s}={}){let o=i?`${i}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){let s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:s=r}={}){let i=typeof s>"u"?"offset":`${s}.offset`,o=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(o,`${e-t+1}`),this}abortSignal(t){return this.signal=t,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:t=!1,verbose:e=!1,settings:r=!1,buffers:s=!1,wal:i=!1,format:o="text"}={}){var a;let h=[t?"analyze":null,e?"verbose":null,r?"settings":null,s?"buffers":null,i?"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+${o}; for="${l}"; options=${h};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};rt.default=et});var W=O(it=>{"use strict";u();Object.defineProperty(it,"__esModule",{value:!0});var _e=(R(),T(S)),Ee=_e.__importDefault(st()),xe=new RegExp("[,()]"),nt=class extends Ee.default{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}in(t,e){let r=Array.from(new Set(e)).map(s=>typeof s=="string"&&xe.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:s}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");let o=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${i}fts${o}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){let s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}};it.default=nt});var lt=O(at=>{"use strict";u();Object.defineProperty(at,"__esModule",{value:!0});var Oe=(R(),T(S)),L=Oe.__importDefault(W()),ot=class{constructor(t,{headers:e={},schema:r,fetch:s}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=s}select(t,e){let{head:r=!1,count:s}=e??{},i=r?"HEAD":"GET",o=!1,a=(t??"*").split("").map(h=>/\s/.test(h)&&!o?"":(h==='"'&&(o=!o),h)).join("");return this.url.searchParams.set("select",a),s&&this.headers.append("Prefer",`count=${s}`),new L.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:r=!0}={}){var s;let i="POST";if(e&&this.headers.append("Prefer",`count=${e}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let o=t.reduce((a,h)=>a.concat(Object.keys(h)),[]);if(o.length>0){let a=[...new Set(o)].map(h=>`"${h}"`);this.url.searchParams.set("columns",a.join(","))}}return new L.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:s,defaultToNull:i=!0}={}){var o;let a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),s&&this.headers.append("Prefer",`count=${s}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let h=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(h.length>0){let l=[...new Set(h)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new L.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(t,{count:e}={}){var r;let s="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new L.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:t}={}){var e;let r="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new L.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}};at.default=ot});var Jt=O(ht=>{"use strict";u();Object.defineProperty(ht,"__esModule",{value:!0});var zt=(R(),T(S)),Se=zt.__importDefault(lt()),Re=zt.__importDefault(W()),ut=class n{constructor(t,{headers:e={},schema:r,fetch:s}={}){this.url=t,this.headers=new Headers(e),this.schemaName=r,this.fetch=s}from(t){let e=new URL(`${this.url}/${t}`);return new Se.default(e,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new n(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,e={},{head:r=!1,get:s=!1,count:i}={}){var o;let a,h=new URL(`${this.url}/rpc/${t}`),l;r||s?(a=r?"HEAD":"GET",Object.entries(e).filter(([d,m])=>m!==void 0).map(([d,m])=>[d,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([d,m])=>{h.searchParams.append(d,m)})):(a="POST",l=e);let c=new Headers(this.headers);return i&&c.set("Prefer",`count=${i}`),new Re.default({method:a,url:h,headers:c,schema:this.schemaName,body:l,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};ht.default=ut});var Zt=O(v=>{"use strict";u();Object.defineProperty(v,"__esModule",{value:!0});v.PostgrestError=v.PostgrestBuilder=v.PostgrestTransformBuilder=v.PostgrestFilterBuilder=v.PostgrestQueryBuilder=v.PostgrestClient=void 0;var U=(R(),T(S)),Gt=U.__importDefault(Jt());v.PostgrestClient=Gt.default;var Kt=U.__importDefault(lt());v.PostgrestQueryBuilder=Kt.default;var Yt=U.__importDefault(W());v.PostgrestFilterBuilder=Yt.default;var Vt=U.__importDefault(st());v.PostgrestTransformBuilder=Vt.default;var Qt=U.__importDefault(tt());v.PostgrestBuilder=Qt.default;var Xt=U.__importDefault(Q());v.PostgrestError=Xt.default;v.default={PostgrestClient:Gt.default,PostgrestQueryBuilder:Kt.default,PostgrestFilterBuilder:Yt.default,PostgrestTransformBuilder:Vt.default,PostgrestBuilder:Qt.default,PostgrestError:Xt.default}});u();u();var ft=class{constructor(t,e=""){this.http=t,this.baseUrl=e.replace(/\/$/,"")}async invoke(t,e){let r=this.baseUrl?`${this.baseUrl}/functions/${t}`:`/functions/${t}`;return await(await this.http.fetch(r,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};u();u();var _="nvwa_current_jwt",x="nvwa_login_token",$="nvwa_user_profile",gt="set-auth-token",ce=typeof fetch<"u"?(n,t)=>fetch(n,t):()=>{throw new Error("AuthClient requires fetch")},z=class{constructor(t,e={}){this.baseUrl=t.replace(/\/$/,""),this.authPath=(e.authPath??"/auth").replace(/^\//,""),this.fetchImpl=e.fetchImpl??ce,this.storage=e.storage??null,this.credentials=e.credentials??"omit",typeof console<"u"&&(console.warn("[NvwaAuth] init baseUrl:",this.baseUrl||"(empty)"),(!this.baseUrl||!this.baseUrl.startsWith("http://")&&!this.baseUrl.startsWith("https://"))&&console.warn("[NvwaAuth] baseUrl \u5E94\u4E3A\u5B8C\u6574\u5730\u5740\uFF08\u5982 https://xxx.nvwa.app\uFF09\uFF0C\u5426\u5219\u5C0F\u7A0B\u5E8F request \u4F1A\u62A5 invalid url"))}async currentUser(){if(this.storage){let r=await this.storage.get($);if(r!=null)return r}let{data:t}=await this.getSession(),e=t?.user??null;return e&&this.storage&&await this.storage.set($,e),e}async getCurrentJwt(){if(this.storage){let e=await this.storage.get(_);if(e!=null)return e;let r=await this.storage.get(x),{data:s}=await this.getToken(r??void 0);return s?.token?(await this.storage.set(_,s.token),s.token):null}let{data:t}=await this.getToken();return t?.token??null}async persistLogin(t,e){if(!this.storage)return;let s=e?.headers.get(gt)?.trim()||t.token||t.session?.token;s&&await this.storage.set(x,s),t.user&&await this.storage.set($,t.user);let i=s??await this.storage.get(x),{data:o}=await this.getToken(i??void 0);o?.token&&await this.storage.set(_,o.token)}async clearLogin(){this.storage&&(await this.storage.remove(x),await this.storage.remove($),await this.storage.remove(_))}url(t){let r=`${`${this.baseUrl.replace(/\/+$/,"")}/${this.authPath.replace(/^\/+/,"")}`}/${t.replace(/^\/+/,"")}`;return typeof console<"u"&&(console.warn("[NvwaAuth] request URL:",r),!r.startsWith("http://")&&!r.startsWith("https://")&&console.warn("[NvwaAuth] URL \u975E\u5B8C\u6574\u5730\u5740\uFF0C\u5C0F\u7A0B\u5E8F\u4F1A\u62A5 invalid url\uFF0C\u8BF7\u68C0\u67E5 Nvwa \u6784\u9020\u65F6\u4F20\u5165\u7684 baseUrl")),r}async getSession(){try{let t={};if(this.storage){let s=await this.storage.get(x)??await this.storage.get(_);s!=null&&(t.Authorization=`Bearer ${s}`)}let e=await this.fetchImpl(this.url("session"),{method:"GET",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return e.ok?{data:await e.json()}:{data:null,error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{data:null,error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signInWithEmail(t,e){try{let r=await this.fetchImpl(this.url("sign-in/email"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify({email:t,password:e})}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return i&&await this.persistLogin({user:i.user,session:i.session},r),{data:i}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async signOut(){try{let t={};if(this.storage){let r=await this.storage.get(x)??await this.storage.get(_);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("sign-out"),{method:"POST",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return await this.clearLogin(),e.ok?{}:{error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signUp(t){let e=await this.postJson("sign-up/email",t);return e.data&&await this.persistLogin(e.data,e.response),e}async getToken(t){try{let e={};if(t)e.Authorization=`Bearer ${t}`;else if(this.storage){let o=await this.storage.get(x)??await this.storage.get(_);o!=null&&(e.Authorization=`Bearer ${o}`)}let r=await this.fetchImpl(this.url("token"),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return{data:i?.token!=null?{token:i.token}:void 0}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async signInWithUsername(t,e){let r=await this.postJson("sign-in/username",{username:t,password:e});return r.data&&await this.persistLogin(r.data,r.response),r}async signInWithPhoneNumber(t,e,r){let s=await this.postJson("sign-in/phone-number",{phoneNumber:t,password:e,rememberMe:r});return s.data&&await this.persistLogin(s.data,s.response),s}async sendPhoneNumberOtp(t){let e=await this.postJson("phone-number/send-otp",{phoneNumber:t});return e.error?{error:e.error}:{}}async verifyPhoneNumber(t,e){let r=await this.postJson("phone-number/verify",{phoneNumber:t,code:e});return r.data&&await this.persistLogin(r.data,r.response),r}async loginWithWeChatCode(t,e){try{let r={"Content-Type":"application/json"};if(this.storage){let a=await this.storage.get(_);a!=null&&(r.Authorization=`Bearer ${a}`)}let s=await this.fetchImpl(this.url("wechat/openplatform/sign-in"),{method:"POST",headers:r,credentials:this.credentials,body:JSON.stringify({code:t,applicationCode:e})}),i=await s.text();if(!s.ok)return{error:{message:i||s.statusText,status:s.status}};let o=i?JSON.parse(i):null;return!o?.token||!o.user?{error:{message:"invalid_wechat_login_response",status:502}}:(this.storage&&(await this.storage.set(_,o.token),await this.storage.set(x,o.token),await this.storage.set($,o.user)),{data:o})}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async getWeChatOpenPlatformIdentity(t){try{let e={};if(this.storage){let a=await this.storage.get(_);a!=null&&(e.Authorization=`Bearer ${a}`)}let r=t?.trim()?`?appId=${encodeURIComponent(t.trim())}`:"",s=await this.fetchImpl(this.url(`wechat/openplatform/identity${r}`),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),i=await s.text();if(!s.ok)return{error:{message:i||s.statusText,status:s.status}};let o=i?JSON.parse(i):null;return!o?.openid||!o.appId?{error:{message:"invalid_wechat_identity_response",status:502}}:{data:o}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async postJson(t,e){try{let r=await this.fetchImpl(this.url(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify(e)}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return{data:i?.data??i??void 0,response:r}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}};u();u();var P=class n{constructor(t){this.headerMap=new Map;if(t){if(t instanceof n)t.forEach((e,r)=>this.set(r,e));else if(Array.isArray(t))for(let[e,r]of t)this.set(e,String(r));else if(typeof t=="object")for(let e of Object.keys(t))this.set(e,String(t[e]))}}append(t,e){let r=t.toLowerCase(),s=this.headerMap.get(r);this.headerMap.set(r,s?`${s}, ${e}`:e)}set(t,e){this.headerMap.set(t.toLowerCase(),String(e))}get(t){let e=this.headerMap.get(t.toLowerCase());return e??null}has(t){return this.headerMap.has(t.toLowerCase())}delete(t){this.headerMap.delete(t.toLowerCase())}forEach(t){for(let[e,r]of this.headerMap.entries())t(r,e,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},C=class n{constructor(t){this.params=new Map;if(t){if(typeof t=="string")this.parseString(t);else if(t instanceof n)this.params=new Map(t.params);else if(Array.isArray(t))for(let[e,r]of t)this.append(e,r);else if(t&&typeof t=="object")for(let[e,r]of Object.entries(t))this.set(e,r)}}parseString(t){t.startsWith("?")&&(t=t.slice(1));let e=t.split("&");for(let r of e)if(r){let[s,i]=r.split("=");s&&this.append(decodeURIComponent(s),i?decodeURIComponent(i):"")}}append(t,e){let r=this.params.get(t)||[];r.push(e),this.params.set(t,r)}delete(t){this.params.delete(t)}get(t){let e=this.params.get(t);return e?e[0]:null}getAll(t){return this.params.get(t)||[]}has(t){return this.params.has(t)}set(t,e){this.params.set(t,[e])}sort(){let t=Array.from(this.params.entries()).sort(([e],[r])=>e.localeCompare(r));this.params=new Map(t)}toString(){let t=[];for(let[e,r]of this.params.entries())for(let s of r)t.push(`${encodeURIComponent(e)}=${encodeURIComponent(s)}`);return t.join("&")}forEach(t){for(let[e,r]of this.params.entries())for(let s of r)t(s,e,this)}keys(){return this.params.keys()}values(){let t=[];for(let e of this.params.values())t.push(...e);return t[Symbol.iterator]()}entries(){let t=[];for(let[e,r]of this.params.entries())for(let s of r)t.push([e,s]);return t[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},I=class n{constructor(t,e){let r;if(t instanceof n)r=t.href;else if(e){let i=e instanceof n?e.href:e;r=this.resolve(i,t)}else r=t;let s=this.parseUrl(r);this.href=r,this.origin=`${s.protocol}//${s.host}`,this.protocol=s.protocol,this.username=s.username,this.password=s.password,this.host=s.host,this.hostname=s.hostname,this.port=s.port,this.pathname=s.pathname,this.search=s.search,this.searchParams=new C(s.search),this.hash=s.hash}resolve(t,e){if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("//"))return`${this.parseUrl(t).protocol}${e}`;if(e.startsWith("/")){let i=this.parseUrl(t);return`${i.protocol}//${i.host}${e}`}let r=this.parseUrl(t),s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return`${r.protocol}//${r.host}${s}${e}`}parseUrl(t){let e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)throw new TypeError("Invalid URL");let r=e[2]||"",s=e[4]||"",i=e[5]||"/",o=e[7]?`?${e[7]}`:"",a=e[9]?`#${e[9]}`:"";if(!r&&!s&&!i.startsWith("/")&&!i.includes("/")&&!i.includes("."))throw new TypeError("Invalid URL");let h=s.match(/^([^@]*)@(.+)$/),l="",c="",d=s;if(h){let b=h[1];d=h[2];let w=b.match(/^([^:]*):?(.*)$/);w&&(l=w[1]||"",c=w[2]||"")}let m=d.match(/^([^:]+):?(\d*)$/),p=m?m[1]:d,y=m&&m[2]?m[2]:"";return{protocol:r?`${r}:`:"",username:l,password:c,host:d,hostname:p,port:y,pathname:i,search:o,hash:a}}toString(){let t=this.searchParams.toString(),e=t?`?${t}`:"";return`${this.protocol}//${this.host}${this.pathname}${e}${this.hash}`}toJSON(){return this.toString()}};u();var k=class n{constructor(t,e){if(typeof t=="string")this.url=t;else if(t?.url)this.url=String(t.url);else if(typeof t?.toString=="function")this.url=String(t.toString());else throw new Error("Invalid input for Request");this.method=(e?.method||"GET").toUpperCase(),this.headers=e?.headers instanceof P?e.headers:new P(e?.headers),this.body=e?.body,this.timeout=e?.timeout,this.signal=e?.signal||void 0}clone(){return new n(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};u();var q=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=de(e?.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 t=await this.text();return new TextEncoder().encode(t).buffer}};function de(n){return n?new P(n):new P}u();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 t of Array.from(this.listeners))try{t()}catch{}this.listeners.clear()}}addEventListener(t,e){if(this._aborted){try{e()}catch{}return}this.listeners.add(e)}removeEventListener(t,e){this.listeners.delete(e)}toString(){return"[object AbortSignal]"}},M=class{constructor(){this._signal=new j}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};u();function Ze(n){n.URL=I,n.URLSearchParams=C,n.Headers=P,n.Request=k,n.Response=q,n.AbortController=M,n.AbortSignal=j}var mt=class{constructor(t,e,r){this.storage=t,this.customFetch=e,this.handleUnauthorized=r}async fetch(t,e){return await this.customFetch(t,e)}async fetchWithAuth(t,e){let r=await this.storage.get(_),s=new P(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let i=e?.method||"GET";if((i==="POST"||i==="PUT"||i==="PATCH")&&e?.body){let a=s.get("Content-Type");(!a||a.includes("text/plain"))&&s.set("Content-Type","application/json")}let o=await this.customFetch(t,{...e,headers:s});if(o.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return o}};u();var pe="/storage",fe=pe+"/generateUploadUrl",yt=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+fe,{method:"POST",body:{fileName:t.name||t.fileName,fileSize:t.size||t.fileSize,fileType:t.type||t.fileType}}),{url:r}=await e.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:t,headers:new P({"Content-Type":t.type||t.fileType||"application/octet-stream"})}),{url:i}=await s.json();return{url:i.split("?")[0]}}};u();u();u();var ct=he(Zt(),1),{PostgrestClient:te,PostgrestQueryBuilder:kr,PostgrestFilterBuilder:qr,PostgrestTransformBuilder:Mr,PostgrestBuilder:Dr,PostgrestError:Br}=ct.default||ct;var Te="/entities",Jr=(n,t)=>new te(n+Te,{fetch:t.fetchWithAuth.bind(t)});u();var ee=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,i=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(i.status!==200)throw new Error(i.message);return i.data}};u();var re=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,i=await(await this.http.fetchWithAuth(r,{method:"POST",body:e!=null?JSON.stringify(e):void 0,timeout:6e5})).json();if(i.status!==200)throw new Error(i.message);return i.data}};u();var se=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 t=document.createElement("style");t.id="__nvwa-inspector-overlay-style",t.textContent=`
|
|
1
|
+
var ne=Object.create;var H=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var dt=(n,t)=>()=>(n&&(t=n(n=0)),t);var O=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),ue=(n,t)=>{for(var e in t)H(n,e,{get:t[e],enumerable:!0})},pt=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of oe(t))!le.call(n,s)&&s!==e&&H(n,s,{get:()=>t[s],enumerable:!(r=ie(t,s))||r.enumerable});return n};var he=(n,t,e)=>(e=n!=null?ne(ae(n)):{},pt(t||!n||!n.__esModule?H(e,"default",{value:n,enumerable:!0}):e,n)),T=n=>pt(H({},"__esModule",{value:!0}),n);import Ue from"path";import{fileURLToPath as je}from"url";var u=dt(()=>{"use strict"});var S={};ue(S,{__addDisposableResource:()=>Bt,__assign:()=>D,__asyncDelegator:()=>Lt,__asyncGenerator:()=>jt,__asyncValues:()=>Nt,__await:()=>A,__awaiter:()=>Rt,__classPrivateFieldGet:()=>qt,__classPrivateFieldIn:()=>Dt,__classPrivateFieldSet:()=>Mt,__createBinding:()=>F,__decorate:()=>bt,__disposeResources:()=>Ft,__esDecorate:()=>_t,__exportStar:()=>$t,__extends:()=>wt,__generator:()=>Tt,__importDefault:()=>kt,__importStar:()=>It,__makeTemplateObject:()=>Ht,__metadata:()=>St,__param:()=>Pt,__propKey:()=>xt,__read:()=>K,__rest:()=>vt,__rewriteRelativeImportExtension:()=>Wt,__runInitializers:()=>Et,__setFunctionName:()=>Ot,__spread:()=>At,__spreadArray:()=>Ct,__spreadArrays:()=>Ut,__values:()=>B,default:()=>ye});function wt(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");J(n,t);function e(){this.constructor=n}n.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function vt(n,t){var e={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&t.indexOf(r)<0&&(e[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s<r.length;s++)t.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(n,r[s])&&(e[r[s]]=n[r[s]]);return e}function bt(n,t,e,r){var s=arguments.length,i=s<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(n,t,e,r);else for(var a=n.length-1;a>=0;a--)(o=n[a])&&(i=(s<3?o(i):s>3?o(t,e,i):o(t,e))||i);return s>3&&i&&Object.defineProperty(t,e,i),i}function Pt(n,t){return function(e,r){t(e,r,n)}}function _t(n,t,e,r,s,i){function o(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var a=r.kind,h=a==="getter"?"get":a==="setter"?"set":"value",l=!t&&n?r.static?n:n.prototype:null,c=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,m=!1,p=e.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(E){if(m)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(E||null))};var w=(0,e[p])(a==="accessor"?{get:c.get,set:c.set}:c[h],y);if(a==="accessor"){if(w===void 0)continue;if(w===null||typeof w!="object")throw new TypeError("Object expected");(d=o(w.get))&&(c.get=d),(d=o(w.set))&&(c.set=d),(d=o(w.init))&&s.unshift(d)}else(d=o(w))&&(a==="field"?s.unshift(d):c[h]=d)}l&&Object.defineProperty(l,r.name,c),m=!0}function Et(n,t,e){for(var r=arguments.length>2,s=0;s<t.length;s++)e=r?t[s].call(n,e):t[s].call(n);return r?e:void 0}function xt(n){return typeof n=="symbol"?n:"".concat(n)}function Ot(n,t,e){return typeof t=="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(n,"name",{configurable:!0,value:e?"".concat(e," ",t):t})}function St(n,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(n,t)}function Rt(n,t,e,r){function s(i){return i instanceof e?i:new e(function(o){o(i)})}return new(e||(e=Promise))(function(i,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function h(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?i(c.value):s(c.value).then(a,h)}l((r=r.apply(n,t||[])).next())})}function Tt(n,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},r,s,i,o=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(l){return function(c){return h([l,c])}}function h(l){if(r)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(e=0)),e;)try{if(r=1,s&&(i=l[0]&2?s.return:l[0]?s.throw||((i=s.return)&&i.call(s),0):s.next)&&!(i=i.call(s,l[1])).done)return i;switch(s=0,i&&(l=[l[0]&2,i.value]),l[0]){case 0:case 1:i=l;break;case 4:return e.label++,{value:l[1],done:!1};case 5:e.label++,s=l[1],l=[0];continue;case 7:l=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(l[0]===6||l[0]===2)){e=0;continue}if(l[0]===3&&(!i||l[1]>i[0]&&l[1]<i[3])){e.label=l[1];break}if(l[0]===6&&e.label<i[1]){e.label=i[1],i=l;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(l);break}i[2]&&e.ops.pop(),e.trys.pop();continue}l=t.call(n,e)}catch(c){l=[6,c],s=0}finally{r=i=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function $t(n,t){for(var e in n)e!=="default"&&!Object.prototype.hasOwnProperty.call(t,e)&&F(t,n,e)}function B(n){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&n[t],r=0;if(e)return e.call(n);if(n&&typeof n.length=="number")return{next:function(){return n&&r>=n.length&&(n=void 0),{value:n&&n[r++],done:!n}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(n,t){var e=typeof Symbol=="function"&&n[Symbol.iterator];if(!e)return n;var r=e.call(n),s,i=[],o;try{for(;(t===void 0||t-- >0)&&!(s=r.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(e=r.return)&&e.call(r)}finally{if(o)throw o.error}}return i}function At(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(K(arguments[t]));return n}function Ut(){for(var n=0,t=0,e=arguments.length;t<e;t++)n+=arguments[t].length;for(var r=Array(n),s=0,t=0;t<e;t++)for(var i=arguments[t],o=0,a=i.length;o<a;o++,s++)r[s]=i[o];return r}function Ct(n,t,e){if(e||arguments.length===2)for(var r=0,s=t.length,i;r<s;r++)(i||!(r in t))&&(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return n.concat(i||Array.prototype.slice.call(t))}function A(n){return this instanceof A?(this.v=n,this):new A(n)}function jt(n,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=e.apply(n,t||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(p){return function(y){return Promise.resolve(y).then(p,d)}}function a(p,y){r[p]&&(s[p]=function(b){return new Promise(function(w,E){i.push([p,b,w,E])>1||h(p,b)})},y&&(s[p]=y(s[p])))}function h(p,y){try{l(r[p](y))}catch(b){m(i[0][3],b)}}function l(p){p.value instanceof A?Promise.resolve(p.value.v).then(c,d):m(i[0][2],p)}function c(p){h("next",p)}function d(p){h("throw",p)}function m(p,y){p(y),i.shift(),i.length&&h(i[0][0],i[0][1])}}function Lt(n){var t,e;return t={},r("next"),r("throw",function(s){throw s}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(s,i){t[s]=n[s]?function(o){return(e=!e)?{value:A(n[s](o)),done:!1}:i?i(o):o}:i}}function Nt(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=n[Symbol.asyncIterator],e;return t?t.call(n):(n=typeof B=="function"?B(n):n[Symbol.iterator](),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(i){e[i]=n[i]&&function(o){return new Promise(function(a,h){o=n[i](o),s(a,h,o.done,o.value)})}}function s(i,o,a,h){Promise.resolve(h).then(function(l){i({value:l,done:a})},o)}}function Ht(n,t){return Object.defineProperty?Object.defineProperty(n,"raw",{value:t}):n.raw=t,n}function It(n){if(n&&n.__esModule)return n;var t={};if(n!=null)for(var e=G(n),r=0;r<e.length;r++)e[r]!=="default"&&F(t,n,e[r]);return ge(t,n),t}function kt(n){return n&&n.__esModule?n:{default:n}}function qt(n,t,e,r){if(e==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?n!==t||!r:!t.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?r:e==="a"?r.call(n):r?r.value:t.get(n)}function Mt(n,t,e,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?n!==t||!s:!t.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(n,e):s?s.value=e:t.set(n,e),e}function Dt(n,t){if(t===null||typeof t!="object"&&typeof t!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof n=="function"?t===n:n.has(t)}function Bt(n,t,e){if(t!=null){if(typeof t!="object"&&typeof t!="function")throw new TypeError("Object expected.");var r,s;if(e){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");r=t[Symbol.dispose],e&&(s=r)}if(typeof r!="function")throw new TypeError("Object not disposable.");s&&(r=function(){try{s.call(this)}catch(i){return Promise.reject(i)}}),n.stack.push({value:t,dispose:r,async:e})}else e&&n.stack.push({async:!0});return t}function Ft(n){function t(i){n.error=n.hasError?new me(i,n.error,"An error was suppressed during disposal."):i,n.hasError=!0}var e,r=0;function s(){for(;e=n.stack.pop();)try{if(!e.async&&r===1)return r=0,n.stack.push(e),Promise.resolve().then(s);if(e.dispose){var i=e.dispose.call(e.value);if(e.async)return r|=2,Promise.resolve(i).then(s,function(o){return t(o),s()})}else r|=1}catch(o){t(o)}if(r===1)return n.hasError?Promise.reject(n.error):Promise.resolve();if(n.hasError)throw n.error}return s()}function Wt(n,t){return typeof n=="string"&&/^\.\.?\//.test(n)?n.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,s,i,o){return r?t?".jsx":".js":s&&(!i||!o)?e:s+i+"."+o.toLowerCase()+"js"}):n}var J,D,F,ge,G,me,ye,R=dt(()=>{"use strict";u();J=function(n,t){return J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var s in r)Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s])},J(n,t)};D=function(){return D=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},D.apply(this,arguments)};F=Object.create?(function(n,t,e,r){r===void 0&&(r=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,r,s)}):(function(n,t,e,r){r===void 0&&(r=e),n[r]=t[e]});ge=Object.create?(function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}):function(n,t){n.default=t},G=function(n){return G=Object.getOwnPropertyNames||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[e.length]=r);return e},G(n)};me=typeof SuppressedError=="function"?SuppressedError:function(n,t,e){var r=new Error(e);return r.name="SuppressedError",r.error=n,r.suppressed=t,r};ye={__extends:wt,__assign:D,__rest:vt,__decorate:bt,__param:Pt,__esDecorate:_t,__runInitializers:Et,__propKey:xt,__setFunctionName:Ot,__metadata:St,__awaiter:Rt,__generator:Tt,__createBinding:F,__exportStar:$t,__values:B,__read:K,__spread:At,__spreadArrays:Ut,__spreadArray:Ct,__await:A,__asyncGenerator:jt,__asyncDelegator:Lt,__asyncValues:Nt,__makeTemplateObject:Ht,__importStar:It,__importDefault:kt,__classPrivateFieldGet:qt,__classPrivateFieldSet:Mt,__classPrivateFieldIn:Dt,__addDisposableResource:Bt,__disposeResources:Ft,__rewriteRelativeImportExtension:Wt}});var Q=O(V=>{"use strict";u();Object.defineProperty(V,"__esModule",{value:!0});var Y=class extends Error{constructor(t){super(t.message),this.name="PostgrestError",this.details=t.details,this.hint=t.hint,this.code=t.code}};V.default=Y});var tt=O(Z=>{"use strict";u();Object.defineProperty(Z,"__esModule",{value:!0});var we=(R(),T(S)),ve=we.__importDefault(Q()),X=class{constructor(t){var e,r;this.shouldThrowOnError=!1,this.method=t.method,this.url=t.url,this.headers=new Headers(t.headers),this.schema=t.schema,this.body=t.body,this.shouldThrowOnError=(e=t.shouldThrowOnError)!==null&&e!==void 0?e:!1,this.signal=t.signal,this.isMaybeSingle=(r=t.isMaybeSingle)!==null&&r!==void 0?r:!1,t.fetch?this.fetch=t.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(t,e){return this.headers=new Headers(this.headers),this.headers.set(t,e),this}then(t,e){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,s=r(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async i=>{var o,a,h,l;let c=null,d=null,m=null,p=i.status,y=i.statusText;if(i.ok){if(this.method!=="HEAD"){let N=await i.text();N===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((o=this.headers.get("Accept"))===null||o===void 0)&&o.includes("application/vnd.pgrst.plan+text"))?d=N:d=JSON.parse(N))}let w=(a=this.headers.get("Prefer"))===null||a===void 0?void 0:a.match(/count=(exact|planned|estimated)/),E=(h=i.headers.get("content-range"))===null||h===void 0?void 0:h.split("/");w&&E&&E.length>1&&(m=parseInt(E[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(d)&&(d.length>1?(c={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 w=await i.text();try{c=JSON.parse(w),Array.isArray(c)&&i.status===404&&(d=[],c=null,p=200,y="OK")}catch{i.status===404&&w===""?(p=204,y="No Content"):c={message:w}}if(c&&this.isMaybeSingle&&(!((l=c?.details)===null||l===void 0)&&l.includes("0 rows"))&&(c=null,p=200,y="OK"),c&&this.shouldThrowOnError)throw new ve.default(c)}return{error:c,data:d,count:m,status:p,statusText:y}});return this.shouldThrowOnError||(s=s.catch(i=>{var o,a,h;return{error:{message:`${(o=i?.name)!==null&&o!==void 0?o:"FetchError"}: ${i?.message}`,details:`${(a=i?.stack)!==null&&a!==void 0?a:""}`,hint:"",code:`${(h=i?.code)!==null&&h!==void 0?h:""}`},data:null,count:null,status:0,statusText:""}})),s.then(t,e)}returns(){return this}overrideTypes(){return this}};Z.default=X});var st=O(rt=>{"use strict";u();Object.defineProperty(rt,"__esModule",{value:!0});var be=(R(),T(S)),Pe=be.__importDefault(tt()),et=class extends Pe.default{select(t){let e=!1,r=(t??"*").split("").map(s=>/\s/.test(s)&&!e?"":(s==='"'&&(e=!e),s)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(t,{ascending:e=!0,nullsFirst:r,foreignTable:s,referencedTable:i=s}={}){let o=i?`${i}.order`:"order",a=this.url.searchParams.get(o);return this.url.searchParams.set(o,`${a?`${a},`:""}${t}.${e?"asc":"desc"}${r===void 0?"":r?".nullsfirst":".nullslast"}`),this}limit(t,{foreignTable:e,referencedTable:r=e}={}){let s=typeof r>"u"?"limit":`${r}.limit`;return this.url.searchParams.set(s,`${t}`),this}range(t,e,{foreignTable:r,referencedTable:s=r}={}){let i=typeof s>"u"?"offset":`${s}.offset`,o=typeof s>"u"?"limit":`${s}.limit`;return this.url.searchParams.set(i,`${t}`),this.url.searchParams.set(o,`${e-t+1}`),this}abortSignal(t){return this.signal=t,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:t=!1,verbose:e=!1,settings:r=!1,buffers:s=!1,wal:i=!1,format:o="text"}={}){var a;let h=[t?"analyze":null,e?"verbose":null,r?"settings":null,s?"buffers":null,i?"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+${o}; for="${l}"; options=${h};`),o==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(t){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${t}`),this}};rt.default=et});var W=O(it=>{"use strict";u();Object.defineProperty(it,"__esModule",{value:!0});var _e=(R(),T(S)),Ee=_e.__importDefault(st()),xe=new RegExp("[,()]"),nt=class extends Ee.default{eq(t,e){return this.url.searchParams.append(t,`eq.${e}`),this}neq(t,e){return this.url.searchParams.append(t,`neq.${e}`),this}gt(t,e){return this.url.searchParams.append(t,`gt.${e}`),this}gte(t,e){return this.url.searchParams.append(t,`gte.${e}`),this}lt(t,e){return this.url.searchParams.append(t,`lt.${e}`),this}lte(t,e){return this.url.searchParams.append(t,`lte.${e}`),this}like(t,e){return this.url.searchParams.append(t,`like.${e}`),this}likeAllOf(t,e){return this.url.searchParams.append(t,`like(all).{${e.join(",")}}`),this}likeAnyOf(t,e){return this.url.searchParams.append(t,`like(any).{${e.join(",")}}`),this}ilike(t,e){return this.url.searchParams.append(t,`ilike.${e}`),this}ilikeAllOf(t,e){return this.url.searchParams.append(t,`ilike(all).{${e.join(",")}}`),this}ilikeAnyOf(t,e){return this.url.searchParams.append(t,`ilike(any).{${e.join(",")}}`),this}is(t,e){return this.url.searchParams.append(t,`is.${e}`),this}in(t,e){let r=Array.from(new Set(e)).map(s=>typeof s=="string"&&xe.test(s)?`"${s}"`:`${s}`).join(",");return this.url.searchParams.append(t,`in.(${r})`),this}contains(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cs.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cs.{${e.join(",")}}`):this.url.searchParams.append(t,`cs.${JSON.stringify(e)}`),this}containedBy(t,e){return typeof e=="string"?this.url.searchParams.append(t,`cd.${e}`):Array.isArray(e)?this.url.searchParams.append(t,`cd.{${e.join(",")}}`):this.url.searchParams.append(t,`cd.${JSON.stringify(e)}`),this}rangeGt(t,e){return this.url.searchParams.append(t,`sr.${e}`),this}rangeGte(t,e){return this.url.searchParams.append(t,`nxl.${e}`),this}rangeLt(t,e){return this.url.searchParams.append(t,`sl.${e}`),this}rangeLte(t,e){return this.url.searchParams.append(t,`nxr.${e}`),this}rangeAdjacent(t,e){return this.url.searchParams.append(t,`adj.${e}`),this}overlaps(t,e){return typeof e=="string"?this.url.searchParams.append(t,`ov.${e}`):this.url.searchParams.append(t,`ov.{${e.join(",")}}`),this}textSearch(t,e,{config:r,type:s}={}){let i="";s==="plain"?i="pl":s==="phrase"?i="ph":s==="websearch"&&(i="w");let o=r===void 0?"":`(${r})`;return this.url.searchParams.append(t,`${i}fts${o}.${e}`),this}match(t){return Object.entries(t).forEach(([e,r])=>{this.url.searchParams.append(e,`eq.${r}`)}),this}not(t,e,r){return this.url.searchParams.append(t,`not.${e}.${r}`),this}or(t,{foreignTable:e,referencedTable:r=e}={}){let s=r?`${r}.or`:"or";return this.url.searchParams.append(s,`(${t})`),this}filter(t,e,r){return this.url.searchParams.append(t,`${e}.${r}`),this}};it.default=nt});var lt=O(at=>{"use strict";u();Object.defineProperty(at,"__esModule",{value:!0});var Oe=(R(),T(S)),L=Oe.__importDefault(W()),ot=class{constructor(t,{headers:e={},schema:r,fetch:s}){this.url=t,this.headers=new Headers(e),this.schema=r,this.fetch=s}select(t,e){let{head:r=!1,count:s}=e??{},i=r?"HEAD":"GET",o=!1,a=(t??"*").split("").map(h=>/\s/.test(h)&&!o?"":(h==='"'&&(o=!o),h)).join("");return this.url.searchParams.set("select",a),s&&this.headers.append("Prefer",`count=${s}`),new L.default({method:i,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(t,{count:e,defaultToNull:r=!0}={}){var s;let i="POST";if(e&&this.headers.append("Prefer",`count=${e}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let o=t.reduce((a,h)=>a.concat(Object.keys(h)),[]);if(o.length>0){let a=[...new Set(o)].map(h=>`"${h}"`);this.url.searchParams.set("columns",a.join(","))}}return new L.default({method:i,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(s=this.fetch)!==null&&s!==void 0?s:fetch})}upsert(t,{onConflict:e,ignoreDuplicates:r=!1,count:s,defaultToNull:i=!0}={}){var o;let a="POST";if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),e!==void 0&&this.url.searchParams.set("on_conflict",e),s&&this.headers.append("Prefer",`count=${s}`),i||this.headers.append("Prefer","missing=default"),Array.isArray(t)){let h=t.reduce((l,c)=>l.concat(Object.keys(c)),[]);if(h.length>0){let l=[...new Set(h)].map(c=>`"${c}"`);this.url.searchParams.set("columns",l.join(","))}}return new L.default({method:a,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}update(t,{count:e}={}){var r;let s="PATCH";return e&&this.headers.append("Prefer",`count=${e}`),new L.default({method:s,url:this.url,headers:this.headers,schema:this.schema,body:t,fetch:(r=this.fetch)!==null&&r!==void 0?r:fetch})}delete({count:t}={}){var e;let r="DELETE";return t&&this.headers.append("Prefer",`count=${t}`),new L.default({method:r,url:this.url,headers:this.headers,schema:this.schema,fetch:(e=this.fetch)!==null&&e!==void 0?e:fetch})}};at.default=ot});var Jt=O(ht=>{"use strict";u();Object.defineProperty(ht,"__esModule",{value:!0});var zt=(R(),T(S)),Se=zt.__importDefault(lt()),Re=zt.__importDefault(W()),ut=class n{constructor(t,{headers:e={},schema:r,fetch:s}={}){this.url=t,this.headers=new Headers(e),this.schemaName=r,this.fetch=s}from(t){let e=new URL(`${this.url}/${t}`);return new Se.default(e,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(t){return new n(this.url,{headers:this.headers,schema:t,fetch:this.fetch})}rpc(t,e={},{head:r=!1,get:s=!1,count:i}={}){var o;let a,h=new URL(`${this.url}/rpc/${t}`),l;r||s?(a=r?"HEAD":"GET",Object.entries(e).filter(([d,m])=>m!==void 0).map(([d,m])=>[d,Array.isArray(m)?`{${m.join(",")}}`:`${m}`]).forEach(([d,m])=>{h.searchParams.append(d,m)})):(a="POST",l=e);let c=new Headers(this.headers);return i&&c.set("Prefer",`count=${i}`),new Re.default({method:a,url:h,headers:c,schema:this.schemaName,body:l,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};ht.default=ut});var Zt=O(v=>{"use strict";u();Object.defineProperty(v,"__esModule",{value:!0});v.PostgrestError=v.PostgrestBuilder=v.PostgrestTransformBuilder=v.PostgrestFilterBuilder=v.PostgrestQueryBuilder=v.PostgrestClient=void 0;var U=(R(),T(S)),Gt=U.__importDefault(Jt());v.PostgrestClient=Gt.default;var Kt=U.__importDefault(lt());v.PostgrestQueryBuilder=Kt.default;var Yt=U.__importDefault(W());v.PostgrestFilterBuilder=Yt.default;var Vt=U.__importDefault(st());v.PostgrestTransformBuilder=Vt.default;var Qt=U.__importDefault(tt());v.PostgrestBuilder=Qt.default;var Xt=U.__importDefault(Q());v.PostgrestError=Xt.default;v.default={PostgrestClient:Gt.default,PostgrestQueryBuilder:Kt.default,PostgrestFilterBuilder:Yt.default,PostgrestTransformBuilder:Vt.default,PostgrestBuilder:Qt.default,PostgrestError:Xt.default}});u();u();var ft=class{constructor(t,e=""){this.http=t,this.baseUrl=e.replace(/\/$/,"")}async invoke(t,e){let r=this.baseUrl?`${this.baseUrl}/functions/${t}`:`/functions/${t}`;return await(await this.http.fetch(r,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};u();u();var _="nvwa_current_jwt",x="nvwa_login_token",$="nvwa_user_profile",gt="set-auth-token",ce=typeof fetch<"u"?(n,t)=>fetch(n,t):()=>{throw new Error("AuthClient requires fetch")},z=class{constructor(t,e={}){this.baseUrl=t.replace(/\/$/,""),this.authPath=(e.authPath??"/auth").replace(/^\//,""),this.fetchImpl=e.fetchImpl??ce,this.storage=e.storage??null,this.credentials=e.credentials??"omit",typeof console<"u"&&(console.warn("[NvwaAuth] init baseUrl:",this.baseUrl||"(empty)"),(!this.baseUrl||!this.baseUrl.startsWith("http://")&&!this.baseUrl.startsWith("https://"))&&console.warn("[NvwaAuth] baseUrl \u5E94\u4E3A\u5B8C\u6574\u5730\u5740\uFF08\u5982 https://xxx.nvwa.app\uFF09\uFF0C\u5426\u5219\u5C0F\u7A0B\u5E8F request \u4F1A\u62A5 invalid url"))}async currentUser(){if(this.storage){let r=await this.storage.get($);if(r!=null)return r}let{data:t}=await this.getSession(),e=t?.user??null;return e&&this.storage&&await this.storage.set($,e),e}async getCurrentJwt(){if(this.storage){let e=await this.storage.get(_);if(e!=null)return e;let r=await this.storage.get(x),{data:s}=await this.getToken(r??void 0);return s?.token?(await this.storage.set(_,s.token),s.token):null}let{data:t}=await this.getToken();return t?.token??null}async persistLogin(t,e){if(!this.storage)return;let s=e?.headers.get(gt)?.trim()||t.token||t.session?.token;s&&await this.storage.set(x,s),t.user&&await this.storage.set($,t.user);let i=s??await this.storage.get(x),{data:o}=await this.getToken(i??void 0);o?.token&&await this.storage.set(_,o.token)}async clearLogin(){this.storage&&(await this.storage.remove(x),await this.storage.remove($),await this.storage.remove(_))}url(t){let r=`${`${this.baseUrl.replace(/\/+$/,"")}/${this.authPath.replace(/^\/+/,"")}`}/${t.replace(/^\/+/,"")}`;return typeof console<"u"&&(console.warn("[NvwaAuth] request URL:",r),!r.startsWith("http://")&&!r.startsWith("https://")&&console.warn("[NvwaAuth] URL \u975E\u5B8C\u6574\u5730\u5740\uFF0C\u5C0F\u7A0B\u5E8F\u4F1A\u62A5 invalid url\uFF0C\u8BF7\u68C0\u67E5 Nvwa \u6784\u9020\u65F6\u4F20\u5165\u7684 baseUrl")),r}async getSession(){try{let t={};if(this.storage){let s=await this.storage.get(x)??await this.storage.get(_);s!=null&&(t.Authorization=`Bearer ${s}`)}let e=await this.fetchImpl(this.url("session"),{method:"GET",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return e.ok?{data:await e.json()}:{data:null,error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{data:null,error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signInWithEmail(t,e){try{let r=await this.fetchImpl(this.url("sign-in/email"),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify({email:t,password:e})}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return i&&await this.persistLogin({user:i.user,session:i.session},r),{data:i}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async signOut(){try{let t={};if(this.storage){let r=await this.storage.get(x)??await this.storage.get(_);r!=null&&(t.Authorization=`Bearer ${r}`)}let e=await this.fetchImpl(this.url("sign-out"),{method:"POST",credentials:this.credentials,...Object.keys(t).length?{headers:t}:{}});return await this.clearLogin(),e.ok?{}:{error:{message:await e.text()||e.statusText,status:e.status}}}catch(t){return{error:{message:t instanceof Error?t.message:String(t),status:0}}}}async signUp(t){let e=await this.postJson("sign-up/email",t);return e.data&&await this.persistLogin(e.data,e.response),e}async getToken(t){try{let e={};if(t)e.Authorization=`Bearer ${t}`;else if(this.storage){let o=await this.storage.get(x)??await this.storage.get(_);o!=null&&(e.Authorization=`Bearer ${o}`)}let r=await this.fetchImpl(this.url("token"),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return{data:i?.token!=null?{token:i.token}:void 0}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async signInWithUsername(t,e){let r=await this.postJson("sign-in/username",{username:t,password:e});return r.data&&await this.persistLogin(r.data,r.response),r}async signInWithPhoneNumber(t,e,r){let s=await this.postJson("sign-in/phone-number",{phoneNumber:t,password:e,rememberMe:r});return s.data&&await this.persistLogin(s.data,s.response),s}async sendPhoneNumberOtp(t){let e=await this.postJson("phone-number/send-otp",{phoneNumber:t});return e.error?{error:e.error}:{}}async verifyPhoneNumber(t,e){let r=await this.postJson("phone-number/verify",{phoneNumber:t,code:e});return r.data&&await this.persistLogin(r.data,r.response),r}async loginWithWeChatCode(t,e){try{let r={"Content-Type":"application/json"};if(this.storage){let a=await this.storage.get(_);a!=null&&(r.Authorization=`Bearer ${a}`)}let s=await this.fetchImpl(this.url("wechat/openplatform/sign-in"),{method:"POST",headers:r,credentials:this.credentials,body:JSON.stringify({code:t,applicationCode:e})}),i=await s.text();if(!s.ok)return{error:{message:i||s.statusText,status:s.status}};let o=i?JSON.parse(i):null;return!o?.token||!o.user?{error:{message:"invalid_wechat_login_response",status:502}}:(this.storage&&(await this.storage.set(_,o.token),await this.storage.set(x,o.token),await this.storage.set($,o.user)),{data:o})}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}async getWeChatOpenPlatformIdentity(t){try{let e={};if(this.storage){let a=await this.storage.get(_);a!=null&&(e.Authorization=`Bearer ${a}`)}let r=t?.trim()?`?applicationCode=${encodeURIComponent(t.trim())}`:"",s=await this.fetchImpl(this.url(`wechat/openplatform/identity${r}`),{method:"GET",credentials:this.credentials,...Object.keys(e).length?{headers:e}:{}}),i=await s.text();if(!s.ok)return{error:{message:i||s.statusText,status:s.status}};let o=i?JSON.parse(i):null;return!o?.openid||!o.appId?{error:{message:"invalid_wechat_identity_response",status:502}}:{data:o}}catch(e){return{error:{message:e instanceof Error?e.message:String(e),status:0}}}}async postJson(t,e){try{let r=await this.fetchImpl(this.url(t),{method:"POST",headers:{"Content-Type":"application/json"},credentials:this.credentials,body:JSON.stringify(e)}),s=await r.text();if(!r.ok)return{error:{message:s||r.statusText,status:r.status}};let i=s?JSON.parse(s):void 0;return{data:i?.data??i??void 0,response:r}}catch(r){return{error:{message:r instanceof Error?r.message:String(r),status:0}}}}};u();u();var P=class n{constructor(t){this.headerMap=new Map;if(t){if(t instanceof n)t.forEach((e,r)=>this.set(r,e));else if(Array.isArray(t))for(let[e,r]of t)this.set(e,String(r));else if(typeof t=="object")for(let e of Object.keys(t))this.set(e,String(t[e]))}}append(t,e){let r=t.toLowerCase(),s=this.headerMap.get(r);this.headerMap.set(r,s?`${s}, ${e}`:e)}set(t,e){this.headerMap.set(t.toLowerCase(),String(e))}get(t){let e=this.headerMap.get(t.toLowerCase());return e??null}has(t){return this.headerMap.has(t.toLowerCase())}delete(t){this.headerMap.delete(t.toLowerCase())}forEach(t){for(let[e,r]of this.headerMap.entries())t(r,e,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},C=class n{constructor(t){this.params=new Map;if(t){if(typeof t=="string")this.parseString(t);else if(t instanceof n)this.params=new Map(t.params);else if(Array.isArray(t))for(let[e,r]of t)this.append(e,r);else if(t&&typeof t=="object")for(let[e,r]of Object.entries(t))this.set(e,r)}}parseString(t){t.startsWith("?")&&(t=t.slice(1));let e=t.split("&");for(let r of e)if(r){let[s,i]=r.split("=");s&&this.append(decodeURIComponent(s),i?decodeURIComponent(i):"")}}append(t,e){let r=this.params.get(t)||[];r.push(e),this.params.set(t,r)}delete(t){this.params.delete(t)}get(t){let e=this.params.get(t);return e?e[0]:null}getAll(t){return this.params.get(t)||[]}has(t){return this.params.has(t)}set(t,e){this.params.set(t,[e])}sort(){let t=Array.from(this.params.entries()).sort(([e],[r])=>e.localeCompare(r));this.params=new Map(t)}toString(){let t=[];for(let[e,r]of this.params.entries())for(let s of r)t.push(`${encodeURIComponent(e)}=${encodeURIComponent(s)}`);return t.join("&")}forEach(t){for(let[e,r]of this.params.entries())for(let s of r)t(s,e,this)}keys(){return this.params.keys()}values(){let t=[];for(let e of this.params.values())t.push(...e);return t[Symbol.iterator]()}entries(){let t=[];for(let[e,r]of this.params.entries())for(let s of r)t.push([e,s]);return t[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},I=class n{constructor(t,e){let r;if(t instanceof n)r=t.href;else if(e){let i=e instanceof n?e.href:e;r=this.resolve(i,t)}else r=t;let s=this.parseUrl(r);this.href=r,this.origin=`${s.protocol}//${s.host}`,this.protocol=s.protocol,this.username=s.username,this.password=s.password,this.host=s.host,this.hostname=s.hostname,this.port=s.port,this.pathname=s.pathname,this.search=s.search,this.searchParams=new C(s.search),this.hash=s.hash}resolve(t,e){if(e.startsWith("http://")||e.startsWith("https://"))return e;if(e.startsWith("//"))return`${this.parseUrl(t).protocol}${e}`;if(e.startsWith("/")){let i=this.parseUrl(t);return`${i.protocol}//${i.host}${e}`}let r=this.parseUrl(t),s=r.pathname.endsWith("/")?r.pathname:r.pathname+"/";return`${r.protocol}//${r.host}${s}${e}`}parseUrl(t){let e=t.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!e)throw new TypeError("Invalid URL");let r=e[2]||"",s=e[4]||"",i=e[5]||"/",o=e[7]?`?${e[7]}`:"",a=e[9]?`#${e[9]}`:"";if(!r&&!s&&!i.startsWith("/")&&!i.includes("/")&&!i.includes("."))throw new TypeError("Invalid URL");let h=s.match(/^([^@]*)@(.+)$/),l="",c="",d=s;if(h){let b=h[1];d=h[2];let w=b.match(/^([^:]*):?(.*)$/);w&&(l=w[1]||"",c=w[2]||"")}let m=d.match(/^([^:]+):?(\d*)$/),p=m?m[1]:d,y=m&&m[2]?m[2]:"";return{protocol:r?`${r}:`:"",username:l,password:c,host:d,hostname:p,port:y,pathname:i,search:o,hash:a}}toString(){let t=this.searchParams.toString(),e=t?`?${t}`:"";return`${this.protocol}//${this.host}${this.pathname}${e}${this.hash}`}toJSON(){return this.toString()}};u();var k=class n{constructor(t,e){if(typeof t=="string")this.url=t;else if(t?.url)this.url=String(t.url);else if(typeof t?.toString=="function")this.url=String(t.toString());else throw new Error("Invalid input for Request");this.method=(e?.method||"GET").toUpperCase(),this.headers=e?.headers instanceof P?e.headers:new P(e?.headers),this.body=e?.body,this.timeout=e?.timeout,this.signal=e?.signal||void 0}clone(){return new n(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};u();var q=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=de(e?.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 t=await this.text();return new TextEncoder().encode(t).buffer}};function de(n){return n?new P(n):new P}u();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 t of Array.from(this.listeners))try{t()}catch{}this.listeners.clear()}}addEventListener(t,e){if(this._aborted){try{e()}catch{}return}this.listeners.add(e)}removeEventListener(t,e){this.listeners.delete(e)}toString(){return"[object AbortSignal]"}},M=class{constructor(){this._signal=new j}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};u();function Ze(n){n.URL=I,n.URLSearchParams=C,n.Headers=P,n.Request=k,n.Response=q,n.AbortController=M,n.AbortSignal=j}var mt=class{constructor(t,e,r){this.storage=t,this.customFetch=e,this.handleUnauthorized=r}async fetch(t,e){return await this.customFetch(t,e)}async fetchWithAuth(t,e){let r=await this.storage.get(_),s=new P(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let i=e?.method||"GET";if((i==="POST"||i==="PUT"||i==="PATCH")&&e?.body){let a=s.get("Content-Type");(!a||a.includes("text/plain"))&&s.set("Content-Type","application/json")}let o=await this.customFetch(t,{...e,headers:s});if(o.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return o}};u();var pe="/storage",fe=pe+"/generateUploadUrl",yt=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+fe,{method:"POST",body:{fileName:t.name||t.fileName,fileSize:t.size||t.fileSize,fileType:t.type||t.fileType}}),{url:r}=await e.json();if(!r)throw new Error("\u83B7\u53D6\u4E0A\u4F20URL\u5931\u8D25");let s=await this.http.fetch(r,{method:"PUT",body:t,headers:new P({"Content-Type":t.type||t.fileType||"application/octet-stream"})}),{url:i}=await s.json();return{url:i.split("?")[0]}}};u();u();u();var ct=he(Zt(),1),{PostgrestClient:te,PostgrestQueryBuilder:kr,PostgrestFilterBuilder:qr,PostgrestTransformBuilder:Mr,PostgrestBuilder:Dr,PostgrestError:Br}=ct.default||ct;var Te="/entities",Jr=(n,t)=>new te(n+Te,{fetch:t.fetchWithAuth.bind(t)});u();var ee=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,i=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(i.status!==200)throw new Error(i.message);return i.data}};u();var re=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/capability/${t}/execute`,i=await(await this.http.fetchWithAuth(r,{method:"POST",body:e!=null?JSON.stringify(e):void 0,timeout:6e5})).json();if(i.status!==200)throw new Error(i.message);return i.data}};u();var se=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 t=document.createElement("style");t.id="__nvwa-inspector-overlay-style",t.textContent=`
|
|
2
2
|
.__nvwa-inspector-overlay {
|
|
3
3
|
position: absolute;
|
|
4
4
|
pointer-events: none;
|