@nvwa-app/sdk-uniapp 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var U=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var qe=Object.prototype.hasOwnProperty;var ze=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},Ge=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Be(e))!qe.call(t,n)&&n!==r&&U(t,n,{get:()=>e[n],enumerable:!(s=Fe(e,n))||s.enumerable});return t};var We=t=>Ge(U({},"__esModule",{value:!0}),t);var vt={};ze(vt,{default:()=>R,disableIframeHoverInspector:()=>pt,enableIframeHoverInspector:()=>dt,getIframeSourceLocation:()=>ft,localStorage:()=>De,polyfill:()=>Ce,setupIframeHoverInspector:()=>ut,setupIframeSourceLocationListener:()=>mt,uniappFetch:()=>j});module.exports=We(vt);var Ve=Object.create,N=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Je=Object.getOwnPropertyNames,Qe=Object.getPrototypeOf,Ye=Object.prototype.hasOwnProperty,z=(t,e)=>()=>(t&&(e=t(t=0)),e),_=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xe=(t,e)=>{for(var r in e)N(t,r,{get:e[r],enumerable:!0})},G=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Je(e))!Ye.call(t,n)&&n!==r&&N(t,n,{get:()=>e[n],enumerable:!(s=Ke(e,n))||s.enumerable});return t},Ze=(t,e,r)=>(r=t!=null?Ve(Qe(t)):{},G(e||!t||!t.__esModule?N(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>G(N({},"__esModule",{value:!0}),t),v=z(()=>{"use strict"}),P={};Xe(P,{__addDisposableResource:()=>ye,__assign:()=>T,__asyncDelegator:()=>le,__asyncGenerator:()=>ie,__asyncValues:()=>ce,__await:()=>O,__awaiter:()=>te,__classPrivateFieldGet:()=>pe,__classPrivateFieldIn:()=>me,__classPrivateFieldSet:()=>fe,__createBinding:()=>x,__decorate:()=>K,__disposeResources:()=>ve,__esDecorate:()=>Q,__exportStar:()=>se,__extends:()=>W,__generator:()=>re,__importDefault:()=>de,__importStar:()=>ue,__makeTemplateObject:()=>he,__metadata:()=>ee,__param:()=>J,__propKey:()=>X,__read:()=>D,__rest:()=>V,__rewriteRelativeImportExtension:()=>ge,__runInitializers:()=>Y,__setFunctionName:()=>Z,__spread:()=>ne,__spreadArray:()=>ae,__spreadArrays:()=>oe,__values:()=>I,default:()=>Ee});function W(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");L(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function V(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function K(t,e,r,s){var n=arguments.length,o=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,s);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(o=(n<3?a(o):n>3?a(e,r,o):a(e,r))||o);return n>3&&o&&Object.defineProperty(e,r,o),o}function J(t,e){return function(r,s){e(r,s,t)}}function Q(t,e,r,s,n,o){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var l=s.kind,h=l==="getter"?"get":l==="setter"?"set":"value",i=!e&&t?s.static?t:t.prototype:null,c=e||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),u,f=!1,d=r.length-1;d>=0;d--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(g||null))};var y=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[h],p);if(l==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(u=a(y.get))&&(c.get=u),(u=a(y.set))&&(c.set=u),(u=a(y.init))&&n.unshift(u)}else(u=a(y))&&(l==="field"?n.unshift(u):c[h]=u)}i&&Object.defineProperty(i,s.name,c),f=!0}function Y(t,e,r){for(var s=arguments.length>2,n=0;n<e.length;n++)r=s?e[n].call(t,r):e[n].call(t);return s?r:void 0}function X(t){return typeof t=="symbol"?t:"".concat(t)}function Z(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function ee(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function te(t,e,r,s){function n(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function l(c){try{i(s.next(c))}catch(u){a(u)}}function h(c){try{i(s.throw(c))}catch(u){a(u)}}function i(c){c.done?o(c.value):n(c.value).then(l,h)}i((s=s.apply(t,e||[])).next())})}function re(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},s,n,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(i){return function(c){return h([i,c])}}function h(i){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(r=0)),r;)try{if(s=1,n&&(o=i[0]&2?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[i[0]&2,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){r.label=i[1];break}if(i[0]===6&&r.label<o[1]){r.label=o[1],o=i;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(i);break}o[2]&&r.ops.pop(),r.trys.pop();continue}i=e.call(t,r)}catch(c){i=[6,c],n=0}finally{s=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function se(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&x(e,t,r)}function I(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function D(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),n,o=[],a;try{for(;(e===void 0||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(l){a={error:l}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return o}function ne(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(D(arguments[e]));return t}function oe(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),n=0,e=0;e<r;e++)for(var o=arguments[e],a=0,l=o.length;a<l;a++,n++)s[n]=o[a];return s}function ae(t,e,r){if(r||arguments.length===2)for(var s=0,n=e.length,o;s<n;s++)(o||!(s in e))&&(o||(o=Array.prototype.slice.call(e,0,s)),o[s]=e[s]);return t.concat(o||Array.prototype.slice.call(e))}function O(t){return this instanceof O?(this.v=t,this):new O(t)}function ie(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),n,o=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(d){return function(p){return Promise.resolve(p).then(d,u)}}function l(d,p){s[d]&&(n[d]=function(m){return new Promise(function(y,g){o.push([d,m,y,g])>1||h(d,m)})},p&&(n[d]=p(n[d])))}function h(d,p){try{i(s[d](p))}catch(m){f(o[0][3],m)}}function i(d){d.value instanceof O?Promise.resolve(d.value.v).then(c,u):f(o[0][2],d)}function c(d){h("next",d)}function u(d){h("throw",d)}function f(d,p){d(p),o.shift(),o.length&&h(o[0][0],o[0][1])}}function le(t){var e,r;return e={},s("next"),s("throw",function(n){throw n}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(n,o){e[n]=t[n]?function(a){return(r=!r)?{value:O(t[n](a)),done:!1}:o?o(a):a}:o}}function ce(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof I=="function"?I(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(o){r[o]=t[o]&&function(a){return new Promise(function(l,h){a=t[o](a),n(l,h,a.done,a.value)})}}function n(o,a,l,h){Promise.resolve(h).then(function(i){o({value:i,done:l})},a)}}function he(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ue(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=A(t),s=0;s<r.length;s++)r[s]!=="default"&&x(e,t,r[s]);return we(e,t),e}function de(t){return t&&t.__esModule?t:{default:t}}function pe(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function fe(t,e,r,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function me(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function ye(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(n=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");n&&(s=function(){try{n.call(this)}catch(o){return Promise.reject(o)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function ve(t){function e(o){t.error=t.hasError?new be(o,t.error,"An error was suppressed during disposal."):o,t.hasError=!0}var r,s=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var o=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(o).then(n,function(a){return e(a),n()})}else s|=1}catch(a){e(a)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return n()}function ge(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,n,o,a){return s?e?".jsx":".js":n&&(!o||!a)?r:n+o+"."+a.toLowerCase()+"js"}):t}var L,T,x,we,A,be,Ee,$=z(()=>{"use strict";v(),L=function(t,e){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(r[n]=s[n])},L(t,e)},T=function(){return T=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},T.apply(this,arguments)},x=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,n)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),we=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},A=function(t){return A=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},A(t)},be=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s},Ee={__extends:W,__assign:T,__rest:V,__decorate:K,__param:J,__esDecorate:Q,__runInitializers:Y,__propKey:X,__setFunctionName:Z,__metadata:ee,__awaiter:te,__generator:re,__createBinding:x,__exportStar:se,__values:I,__read:D,__spread:ne,__spreadArrays:oe,__spreadArray:ae,__await:O,__asyncGenerator:ie,__asyncDelegator:le,__asyncValues:ce,__makeTemplateObject:he,__importStar:ue,__importDefault:de,__classPrivateFieldGet:pe,__classPrivateFieldSet:fe,__classPrivateFieldIn:me,__addDisposableResource:ye,__disposeResources:ve,__rewriteRelativeImportExtension:ge}}),_e=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};t.default=e}),Pe=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(_e()),s=class{constructor(n){var o,a;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(o=n.shouldThrowOnError)!==null&&o!==void 0?o:!1,this.signal=n.signal,this.isMaybeSingle=(a=n.isMaybeSingle)!==null&&a!==void 0?a:!1,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,o){return this.headers=new Headers(this.headers),this.headers.set(n,o),this}then(n,o){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 a=this.fetch,l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async h=>{var i,c,u,f;let d=null,p=null,m=null,y=h.status,g=h.statusText;if(h.ok){if(this.method!=="HEAD"){let M=await h.text();M===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text")?p=M:p=JSON.parse(M))}let b=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),E=(u=h.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&E&&E.length>1&&(m=parseInt(E[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(d={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,m=null,y=406,g="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let b=await h.text();try{d=JSON.parse(b),Array.isArray(d)&&h.status===404&&(p=[],d=null,y=200,g="OK")}catch{h.status===404&&b===""?(y=204,g="No Content"):d={message:b}}if(d&&this.isMaybeSingle&&!((f=d?.details)===null||f===void 0)&&f.includes("0 rows")&&(d=null,y=200,g="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:p,count:m,status:y,statusText:g}});return this.shouldThrowOnError||(l=l.catch(h=>{var i,c,u;return{error:{message:`${(i=h?.name)!==null&&i!==void 0?i:"FetchError"}: ${h?.message}`,details:`${(c=h?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(u=h?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),l.then(n,o)}returns(){return this}overrideTypes(){return this}};t.default=s}),Oe=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Pe()),s=class extends r.default{select(n){let o=!1,a=(n??"*").split("").map(l=>/\s/.test(l)&&!o?"":(l==='"'&&(o=!o),l)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:o=!0,nullsFirst:a,foreignTable:l,referencedTable:h=l}={}){let i=h?`${h}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${n}.${o?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:o,referencedTable:a=o}={}){let l=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${n}`),this}range(n,o,{foreignTable:a,referencedTable:l=a}={}){let h=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(h,`${n}`),this.url.searchParams.set(i,`${o-n+1}`),this}abortSignal(n){return this.signal=n,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:n=!1,verbose:o=!1,settings:a=!1,buffers:l=!1,wal:h=!1,format:i="text"}={}){var c;let u=[n?"analyze":null,o?"verbose":null,a?"settings":null,l?"buffers":null,h?"wal":null].filter(Boolean).join("|"),f=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${f}"; options=${u};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};t.default=s}),F=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Oe()),s=new RegExp("[,()]"),n=class extends r.default{eq(o,a){return this.url.searchParams.append(o,`eq.${a}`),this}neq(o,a){return this.url.searchParams.append(o,`neq.${a}`),this}gt(o,a){return this.url.searchParams.append(o,`gt.${a}`),this}gte(o,a){return this.url.searchParams.append(o,`gte.${a}`),this}lt(o,a){return this.url.searchParams.append(o,`lt.${a}`),this}lte(o,a){return this.url.searchParams.append(o,`lte.${a}`),this}like(o,a){return this.url.searchParams.append(o,`like.${a}`),this}likeAllOf(o,a){return this.url.searchParams.append(o,`like(all).{${a.join(",")}}`),this}likeAnyOf(o,a){return this.url.searchParams.append(o,`like(any).{${a.join(",")}}`),this}ilike(o,a){return this.url.searchParams.append(o,`ilike.${a}`),this}ilikeAllOf(o,a){return this.url.searchParams.append(o,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(o,a){return this.url.searchParams.append(o,`ilike(any).{${a.join(",")}}`),this}is(o,a){return this.url.searchParams.append(o,`is.${a}`),this}in(o,a){let l=Array.from(new Set(a)).map(h=>typeof h=="string"&&s.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(o,`in.(${l})`),this}contains(o,a){return typeof a=="string"?this.url.searchParams.append(o,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(o,`cs.{${a.join(",")}}`):this.url.searchParams.append(o,`cs.${JSON.stringify(a)}`),this}containedBy(o,a){return typeof a=="string"?this.url.searchParams.append(o,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(o,`cd.{${a.join(",")}}`):this.url.searchParams.append(o,`cd.${JSON.stringify(a)}`),this}rangeGt(o,a){return this.url.searchParams.append(o,`sr.${a}`),this}rangeGte(o,a){return this.url.searchParams.append(o,`nxl.${a}`),this}rangeLt(o,a){return this.url.searchParams.append(o,`sl.${a}`),this}rangeLte(o,a){return this.url.searchParams.append(o,`nxr.${a}`),this}rangeAdjacent(o,a){return this.url.searchParams.append(o,`adj.${a}`),this}overlaps(o,a){return typeof a=="string"?this.url.searchParams.append(o,`ov.${a}`):this.url.searchParams.append(o,`ov.{${a.join(",")}}`),this}textSearch(o,a,{config:l,type:h}={}){let i="";h==="plain"?i="pl":h==="phrase"?i="ph":h==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(o,`${i}fts${c}.${a}`),this}match(o){return Object.entries(o).forEach(([a,l])=>{this.url.searchParams.append(a,`eq.${l}`)}),this}not(o,a,l){return this.url.searchParams.append(o,`not.${a}.${l}`),this}or(o,{foreignTable:a,referencedTable:l=a}={}){let h=l?`${l}.or`:"or";return this.url.searchParams.append(h,`(${o})`),this}filter(o,a,l){return this.url.searchParams.append(o,`${a}.${l}`),this}};t.default=n}),Se=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(F()),s=class{constructor(n,{headers:o={},schema:a,fetch:l}){this.url=n,this.headers=new Headers(o),this.schema=a,this.fetch=l}select(n,o){let{head:a=!1,count:l}=o??{},h=a?"HEAD":"GET",i=!1,c=(n??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(n,{count:o,defaultToNull:a=!0}={}){var l;let h="POST";if(o&&this.headers.append("Prefer",`count=${o}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(n)){let i=n.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(i.length>0){let c=[...new Set(i)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(n,{onConflict:o,ignoreDuplicates:a=!1,count:l,defaultToNull:h=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),l&&this.headers.append("Prefer",`count=${l}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(n)){let u=n.reduce((f,d)=>f.concat(Object.keys(d)),[]);if(u.length>0){let f=[...new Set(u)].map(d=>`"${d}"`);this.url.searchParams.set("columns",f.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(n,{count:o}={}){var a;let l="PATCH";return o&&this.headers.append("Prefer",`count=${o}`),new r.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:n}={}){var o;let a="DELETE";return n&&this.headers.append("Prefer",`count=${n}`),new r.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};t.default=s}),et=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Se()),s=e.__importDefault(F()),n=class $e{constructor(a,{headers:l={},schema:h,fetch:i}={}){this.url=a,this.headers=new Headers(l),this.schemaName=h,this.fetch=i}from(a){let l=new URL(`${this.url}/${a}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new $e(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,l={},{head:h=!1,get:i=!1,count:c}={}){var u;let f,d=new URL(`${this.url}/rpc/${a}`),p;h||i?(f=h?"HEAD":"GET",Object.entries(l).filter(([y,g])=>g!==void 0).map(([y,g])=>[y,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([y,g])=>{d.searchParams.append(y,g)})):(f="POST",p=l);let m=new Headers(this.headers);return c&&m.set("Prefer",`count=${c}`),new s.default({method:f,url:d,headers:m,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};t.default=n}),tt=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;var e=($(),S(P)),r=e.__importDefault(et());t.PostgrestClient=r.default;var s=e.__importDefault(Se());t.PostgrestQueryBuilder=s.default;var n=e.__importDefault(F());t.PostgrestFilterBuilder=n.default;var o=e.__importDefault(Oe());t.PostgrestTransformBuilder=o.default;var a=e.__importDefault(Pe());t.PostgrestBuilder=a.default;var l=e.__importDefault(_e());t.PostgrestError=l.default,t.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:n.default,PostgrestTransformBuilder:o.default,PostgrestBuilder:a.default,PostgrestError:l.default}});v();v();var Te=class{constructor(t){this.http=t}async invoke(t,e){return await(await this.http.fetch("/functions/"+t,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};v();v();var rt="nvwa_current_jwt";v();v();var w=class xe{constructor(e){if(this.headerMap=new Map,e){if(e instanceof xe)e.forEach((r,s)=>this.set(s,r));else if(Array.isArray(e))for(let[r,s]of e)this.set(r,String(s));else if(typeof e=="object")for(let r of Object.keys(e))this.set(r,String(e[r]))}}append(e,r){let s=e.toLowerCase(),n=this.headerMap.get(s);this.headerMap.set(s,n?`${n}, ${r}`:r)}set(e,r){this.headerMap.set(e.toLowerCase(),String(r))}get(e){return this.headerMap.get(e.toLowerCase())??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[r,s]of this.headerMap.entries())e(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},je=class Le{constructor(e){if(this.params=new Map,e){if(typeof e=="string")this.parseString(e);else if(e instanceof Le)this.params=new Map(e.params);else if(Array.isArray(e))for(let[r,s]of e)this.append(r,s);else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))this.set(r,s)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let r=e.split("&");for(let s of r)if(s){let[n,o]=s.split("=");n&&this.append(decodeURIComponent(n),o?decodeURIComponent(o):"")}}append(e,r){let s=this.params.get(e)||[];s.push(r),this.params.set(e,s)}delete(e){this.params.delete(e)}get(e){let r=this.params.get(e);return r?r[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,r){this.params.set(e,[r])}sort(){let e=Array.from(this.params.entries()).sort(([r],[s])=>r.localeCompare(s));this.params=new Map(e)}toString(){let e=[];for(let[r,s]of this.params.entries())for(let n of s)e.push(`${encodeURIComponent(r)}=${encodeURIComponent(n)}`);return e.join("&")}forEach(e){for(let[r,s]of this.params.entries())for(let n of s)e(n,r,this)}keys(){return this.params.keys()}values(){let e=[];for(let r of this.params.values())e.push(...r);return e[Symbol.iterator]()}entries(){let e=[];for(let[r,s]of this.params.entries())for(let n of s)e.push([r,n]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},st=class k{constructor(e,r){let s;if(e instanceof k)s=e.href;else if(r){let o=r instanceof k?r.href:r;s=this.resolve(o,e)}else s=e;let n=this.parseUrl(s);this.href=s,this.origin=`${n.protocol}//${n.host}`,this.protocol=n.protocol,this.username=n.username,this.password=n.password,this.host=n.host,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.searchParams=new je(n.search),this.hash=n.hash}resolve(e,r){if(r.startsWith("http://")||r.startsWith("https://"))return r;if(r.startsWith("//"))return`${this.parseUrl(e).protocol}${r}`;if(r.startsWith("/")){let o=this.parseUrl(e);return`${o.protocol}//${o.host}${r}`}let s=this.parseUrl(e),n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return`${s.protocol}//${s.host}${n}${r}`}parseUrl(e){let r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!r)throw new TypeError("Invalid URL");let s=r[2]||"",n=r[4]||"",o=r[5]||"/",a=r[7]?`?${r[7]}`:"",l=r[9]?`#${r[9]}`:"";if(!s&&!n&&!o.startsWith("/")&&!o.includes("/")&&!o.includes("."))throw new TypeError("Invalid URL");let h=n.match(/^([^@]*)@(.+)$/),i="",c="",u=n;if(h){let m=h[1];u=h[2];let y=m.match(/^([^:]*):?(.*)$/);y&&(i=y[1]||"",c=y[2]||"")}let f=u.match(/^([^:]+):?(\d*)$/),d=f?f[1]:u,p=f&&f[2]?f[2]:"";return{protocol:s?`${s}:`:"",username:i,password:c,host:u,hostname:d,port:p,pathname:o,search:a,hash:l}}toString(){let e=this.searchParams.toString(),r=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${r}${this.hash}`}toJSON(){return this.toString()}};v();var nt=class Ae{constructor(e,r){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(r?.method||"GET").toUpperCase(),this.headers=r?.headers instanceof w?r.headers:new w(r?.headers),this.body=r?.body,this.timeout=r?.timeout,this.signal=r?.signal||void 0}clone(){return new Ae(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};v();var B=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=ot(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 ot(t){return t?new w(t):new w}v();var Ie=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]"}},at=class{constructor(){this._signal=new Ie}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};v();function Ce(t){t.URL=st,t.URLSearchParams=je,t.Headers=w,t.Request=nt,t.Response=B,t.AbortController=at,t.AbortSignal=Ie}var Ne=class{constructor(t,e,r){console.log("NvwaHttpClient 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(rt),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let n=e?.method||"GET";if((n==="POST"||n==="PUT"||n==="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}};v();var it="/storage",lt=it+"/generateUploadUrl",He=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+lt,{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:n}=await s.json();return{url:n.split("?")[0]}}};v();v();v();var q=Ze(tt(),1),{PostgrestClient:ct,PostgrestQueryBuilder:wt,PostgrestFilterBuilder:bt,PostgrestTransformBuilder:Et,PostgrestBuilder:_t,PostgrestError:Pt}=q.default||q,ht="/entities",Re=(t,e)=>new ct(t+ht,{fetch:e.fetchWithAuth.bind(e)});v();var Me=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/skill/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};v();var Ue=class{constructor(){this.hoverOverlay=null,this.selectedOverlay=null,this.tooltip=null,this.hoverElement=null,this.selectedElement=null,this.hoverUpdateHandler=null,this.selectedUpdateHandler=null,this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let t=document.createElement("style");t.id="__nvwa-inspector-overlay-style",t.textContent=`
|
|
1
|
+
"use strict";var U=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var qe=Object.prototype.hasOwnProperty;var ze=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},Ge=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Be(e))!qe.call(t,n)&&n!==r&&U(t,n,{get:()=>e[n],enumerable:!(s=Fe(e,n))||s.enumerable});return t};var We=t=>Ge(U({},"__esModule",{value:!0}),t);var vt={};ze(vt,{default:()=>R,disableIframeHoverInspector:()=>pt,enableIframeHoverInspector:()=>dt,getIframeSourceLocation:()=>ft,localStorage:()=>De,polyfill:()=>Ce,setupIframeHoverInspector:()=>ut,setupIframeSourceLocationListener:()=>mt,uniappFetch:()=>j});module.exports=We(vt);var Ve=Object.create,N=Object.defineProperty,Ke=Object.getOwnPropertyDescriptor,Je=Object.getOwnPropertyNames,Qe=Object.getPrototypeOf,Ye=Object.prototype.hasOwnProperty,z=(t,e)=>()=>(t&&(e=t(t=0)),e),_=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Xe=(t,e)=>{for(var r in e)N(t,r,{get:e[r],enumerable:!0})},G=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Je(e))!Ye.call(t,n)&&n!==r&&N(t,n,{get:()=>e[n],enumerable:!(s=Ke(e,n))||s.enumerable});return t},Ze=(t,e,r)=>(r=t!=null?Ve(Qe(t)):{},G(e||!t||!t.__esModule?N(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>G(N({},"__esModule",{value:!0}),t),v=z(()=>{"use strict"}),P={};Xe(P,{__addDisposableResource:()=>ye,__assign:()=>T,__asyncDelegator:()=>le,__asyncGenerator:()=>ie,__asyncValues:()=>ce,__await:()=>O,__awaiter:()=>te,__classPrivateFieldGet:()=>pe,__classPrivateFieldIn:()=>me,__classPrivateFieldSet:()=>fe,__createBinding:()=>x,__decorate:()=>K,__disposeResources:()=>ve,__esDecorate:()=>Q,__exportStar:()=>se,__extends:()=>W,__generator:()=>re,__importDefault:()=>de,__importStar:()=>ue,__makeTemplateObject:()=>he,__metadata:()=>ee,__param:()=>J,__propKey:()=>X,__read:()=>D,__rest:()=>V,__rewriteRelativeImportExtension:()=>ge,__runInitializers:()=>Y,__setFunctionName:()=>Z,__spread:()=>ne,__spreadArray:()=>ae,__spreadArrays:()=>oe,__values:()=>I,default:()=>Ee});function W(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");L(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function V(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,s=Object.getOwnPropertySymbols(t);n<s.length;n++)e.indexOf(s[n])<0&&Object.prototype.propertyIsEnumerable.call(t,s[n])&&(r[s[n]]=t[s[n]]);return r}function K(t,e,r,s){var n=arguments.length,o=n<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,s);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(o=(n<3?a(o):n>3?a(e,r,o):a(e,r))||o);return n>3&&o&&Object.defineProperty(e,r,o),o}function J(t,e){return function(r,s){e(r,s,t)}}function Q(t,e,r,s,n,o){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var l=s.kind,h=l==="getter"?"get":l==="setter"?"set":"value",i=!e&&t?s.static?t:t.prototype:null,c=e||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),u,f=!1,d=r.length-1;d>=0;d--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");o.push(a(g||null))};var y=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[h],p);if(l==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(u=a(y.get))&&(c.get=u),(u=a(y.set))&&(c.set=u),(u=a(y.init))&&n.unshift(u)}else(u=a(y))&&(l==="field"?n.unshift(u):c[h]=u)}i&&Object.defineProperty(i,s.name,c),f=!0}function Y(t,e,r){for(var s=arguments.length>2,n=0;n<e.length;n++)r=s?e[n].call(t,r):e[n].call(t);return s?r:void 0}function X(t){return typeof t=="symbol"?t:"".concat(t)}function Z(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function ee(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function te(t,e,r,s){function n(o){return o instanceof r?o:new r(function(a){a(o)})}return new(r||(r=Promise))(function(o,a){function l(c){try{i(s.next(c))}catch(u){a(u)}}function h(c){try{i(s.throw(c))}catch(u){a(u)}}function i(c){c.done?o(c.value):n(c.value).then(l,h)}i((s=s.apply(t,e||[])).next())})}function re(t,e){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},s,n,o,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(i){return function(c){return h([i,c])}}function h(i){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(r=0)),r;)try{if(s=1,n&&(o=i[0]&2?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[i[0]&2,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,n=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!o||i[1]>o[0]&&i[1]<o[3])){r.label=i[1];break}if(i[0]===6&&r.label<o[1]){r.label=o[1],o=i;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(i);break}o[2]&&r.ops.pop(),r.trys.pop();continue}i=e.call(t,r)}catch(c){i=[6,c],n=0}finally{s=o=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function se(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&x(e,t,r)}function I(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function D(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),n,o=[],a;try{for(;(e===void 0||e-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(l){a={error:l}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return o}function ne(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(D(arguments[e]));return t}function oe(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),n=0,e=0;e<r;e++)for(var o=arguments[e],a=0,l=o.length;a<l;a++,n++)s[n]=o[a];return s}function ae(t,e,r){if(r||arguments.length===2)for(var s=0,n=e.length,o;s<n;s++)(o||!(s in e))&&(o||(o=Array.prototype.slice.call(e,0,s)),o[s]=e[s]);return t.concat(o||Array.prototype.slice.call(e))}function O(t){return this instanceof O?(this.v=t,this):new O(t)}function ie(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),n,o=[];return n=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),n[Symbol.asyncIterator]=function(){return this},n;function a(d){return function(p){return Promise.resolve(p).then(d,u)}}function l(d,p){s[d]&&(n[d]=function(m){return new Promise(function(y,g){o.push([d,m,y,g])>1||h(d,m)})},p&&(n[d]=p(n[d])))}function h(d,p){try{i(s[d](p))}catch(m){f(o[0][3],m)}}function i(d){d.value instanceof O?Promise.resolve(d.value.v).then(c,u):f(o[0][2],d)}function c(d){h("next",d)}function u(d){h("throw",d)}function f(d,p){d(p),o.shift(),o.length&&h(o[0][0],o[0][1])}}function le(t){var e,r;return e={},s("next"),s("throw",function(n){throw n}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(n,o){e[n]=t[n]?function(a){return(r=!r)?{value:O(t[n](a)),done:!1}:o?o(a):a}:o}}function ce(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof I=="function"?I(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(o){r[o]=t[o]&&function(a){return new Promise(function(l,h){a=t[o](a),n(l,h,a.done,a.value)})}}function n(o,a,l,h){Promise.resolve(h).then(function(i){o({value:i,done:l})},a)}}function he(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ue(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=A(t),s=0;s<r.length;s++)r[s]!=="default"&&x(e,t,r[s]);return we(e,t),e}function de(t){return t&&t.__esModule?t:{default:t}}function pe(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function fe(t,e,r,s,n){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r}function me(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function ye(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(n=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");n&&(s=function(){try{n.call(this)}catch(o){return Promise.reject(o)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function ve(t){function e(o){t.error=t.hasError?new be(o,t.error,"An error was suppressed during disposal."):o,t.hasError=!0}var r,s=0;function n(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(n);if(r.dispose){var o=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(o).then(n,function(a){return e(a),n()})}else s|=1}catch(a){e(a)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return n()}function ge(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,n,o,a){return s?e?".jsx":".js":n&&(!o||!a)?r:n+o+"."+a.toLowerCase()+"js"}):t}var L,T,x,we,A,be,Ee,$=z(()=>{"use strict";v(),L=function(t,e){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(r[n]=s[n])},L(t,e)},T=function(){return T=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},T.apply(this,arguments)},x=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var n=Object.getOwnPropertyDescriptor(e,r);(!n||("get"in n?!e.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,n)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),we=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},A=function(t){return A=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},A(t)},be=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s},Ee={__extends:W,__assign:T,__rest:V,__decorate:K,__param:J,__esDecorate:Q,__runInitializers:Y,__propKey:X,__setFunctionName:Z,__metadata:ee,__awaiter:te,__generator:re,__createBinding:x,__exportStar:se,__values:I,__read:D,__spread:ne,__spreadArrays:oe,__spreadArray:ae,__await:O,__asyncGenerator:ie,__asyncDelegator:le,__asyncValues:ce,__makeTemplateObject:he,__importStar:ue,__importDefault:de,__classPrivateFieldGet:pe,__classPrivateFieldSet:fe,__classPrivateFieldIn:me,__addDisposableResource:ye,__disposeResources:ve,__rewriteRelativeImportExtension:ge}}),_e=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};t.default=e}),Pe=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(_e()),s=class{constructor(n){var o,a;this.shouldThrowOnError=!1,this.method=n.method,this.url=n.url,this.headers=new Headers(n.headers),this.schema=n.schema,this.body=n.body,this.shouldThrowOnError=(o=n.shouldThrowOnError)!==null&&o!==void 0?o:!1,this.signal=n.signal,this.isMaybeSingle=(a=n.isMaybeSingle)!==null&&a!==void 0?a:!1,n.fetch?this.fetch=n.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(n,o){return this.headers=new Headers(this.headers),this.headers.set(n,o),this}then(n,o){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 a=this.fetch,l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async h=>{var i,c,u,f;let d=null,p=null,m=null,y=h.status,g=h.statusText;if(h.ok){if(this.method!=="HEAD"){let M=await h.text();M===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text")?p=M:p=JSON.parse(M))}let b=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),E=(u=h.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&E&&E.length>1&&(m=parseInt(E[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(d={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,m=null,y=406,g="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let b=await h.text();try{d=JSON.parse(b),Array.isArray(d)&&h.status===404&&(p=[],d=null,y=200,g="OK")}catch{h.status===404&&b===""?(y=204,g="No Content"):d={message:b}}if(d&&this.isMaybeSingle&&!((f=d?.details)===null||f===void 0)&&f.includes("0 rows")&&(d=null,y=200,g="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:p,count:m,status:y,statusText:g}});return this.shouldThrowOnError||(l=l.catch(h=>{var i,c,u;return{error:{message:`${(i=h?.name)!==null&&i!==void 0?i:"FetchError"}: ${h?.message}`,details:`${(c=h?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(u=h?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),l.then(n,o)}returns(){return this}overrideTypes(){return this}};t.default=s}),Oe=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Pe()),s=class extends r.default{select(n){let o=!1,a=(n??"*").split("").map(l=>/\s/.test(l)&&!o?"":(l==='"'&&(o=!o),l)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(n,{ascending:o=!0,nullsFirst:a,foreignTable:l,referencedTable:h=l}={}){let i=h?`${h}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${n}.${o?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(n,{foreignTable:o,referencedTable:a=o}={}){let l=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${n}`),this}range(n,o,{foreignTable:a,referencedTable:l=a}={}){let h=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(h,`${n}`),this.url.searchParams.set(i,`${o-n+1}`),this}abortSignal(n){return this.signal=n,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:n=!1,verbose:o=!1,settings:a=!1,buffers:l=!1,wal:h=!1,format:i="text"}={}){var c;let u=[n?"analyze":null,o?"verbose":null,a?"settings":null,l?"buffers":null,h?"wal":null].filter(Boolean).join("|"),f=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${f}"; options=${u};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(n){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${n}`),this}};t.default=s}),F=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Oe()),s=new RegExp("[,()]"),n=class extends r.default{eq(o,a){return this.url.searchParams.append(o,`eq.${a}`),this}neq(o,a){return this.url.searchParams.append(o,`neq.${a}`),this}gt(o,a){return this.url.searchParams.append(o,`gt.${a}`),this}gte(o,a){return this.url.searchParams.append(o,`gte.${a}`),this}lt(o,a){return this.url.searchParams.append(o,`lt.${a}`),this}lte(o,a){return this.url.searchParams.append(o,`lte.${a}`),this}like(o,a){return this.url.searchParams.append(o,`like.${a}`),this}likeAllOf(o,a){return this.url.searchParams.append(o,`like(all).{${a.join(",")}}`),this}likeAnyOf(o,a){return this.url.searchParams.append(o,`like(any).{${a.join(",")}}`),this}ilike(o,a){return this.url.searchParams.append(o,`ilike.${a}`),this}ilikeAllOf(o,a){return this.url.searchParams.append(o,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(o,a){return this.url.searchParams.append(o,`ilike(any).{${a.join(",")}}`),this}is(o,a){return this.url.searchParams.append(o,`is.${a}`),this}in(o,a){let l=Array.from(new Set(a)).map(h=>typeof h=="string"&&s.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(o,`in.(${l})`),this}contains(o,a){return typeof a=="string"?this.url.searchParams.append(o,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(o,`cs.{${a.join(",")}}`):this.url.searchParams.append(o,`cs.${JSON.stringify(a)}`),this}containedBy(o,a){return typeof a=="string"?this.url.searchParams.append(o,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(o,`cd.{${a.join(",")}}`):this.url.searchParams.append(o,`cd.${JSON.stringify(a)}`),this}rangeGt(o,a){return this.url.searchParams.append(o,`sr.${a}`),this}rangeGte(o,a){return this.url.searchParams.append(o,`nxl.${a}`),this}rangeLt(o,a){return this.url.searchParams.append(o,`sl.${a}`),this}rangeLte(o,a){return this.url.searchParams.append(o,`nxr.${a}`),this}rangeAdjacent(o,a){return this.url.searchParams.append(o,`adj.${a}`),this}overlaps(o,a){return typeof a=="string"?this.url.searchParams.append(o,`ov.${a}`):this.url.searchParams.append(o,`ov.{${a.join(",")}}`),this}textSearch(o,a,{config:l,type:h}={}){let i="";h==="plain"?i="pl":h==="phrase"?i="ph":h==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(o,`${i}fts${c}.${a}`),this}match(o){return Object.entries(o).forEach(([a,l])=>{this.url.searchParams.append(a,`eq.${l}`)}),this}not(o,a,l){return this.url.searchParams.append(o,`not.${a}.${l}`),this}or(o,{foreignTable:a,referencedTable:l=a}={}){let h=l?`${l}.or`:"or";return this.url.searchParams.append(h,`(${o})`),this}filter(o,a,l){return this.url.searchParams.append(o,`${a}.${l}`),this}};t.default=n}),Se=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(F()),s=class{constructor(n,{headers:o={},schema:a,fetch:l}){this.url=n,this.headers=new Headers(o),this.schema=a,this.fetch=l}select(n,o){let{head:a=!1,count:l}=o??{},h=a?"HEAD":"GET",i=!1,c=(n??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(n,{count:o,defaultToNull:a=!0}={}){var l;let h="POST";if(o&&this.headers.append("Prefer",`count=${o}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(n)){let i=n.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(i.length>0){let c=[...new Set(i)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(n,{onConflict:o,ignoreDuplicates:a=!1,count:l,defaultToNull:h=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),l&&this.headers.append("Prefer",`count=${l}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(n)){let u=n.reduce((f,d)=>f.concat(Object.keys(d)),[]);if(u.length>0){let f=[...new Set(u)].map(d=>`"${d}"`);this.url.searchParams.set("columns",f.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(n,{count:o}={}){var a;let l="PATCH";return o&&this.headers.append("Prefer",`count=${o}`),new r.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:n,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:n}={}){var o;let a="DELETE";return n&&this.headers.append("Prefer",`count=${n}`),new r.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}};t.default=s}),et=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Se()),s=e.__importDefault(F()),n=class $e{constructor(a,{headers:l={},schema:h,fetch:i}={}){this.url=a,this.headers=new Headers(l),this.schemaName=h,this.fetch=i}from(a){let l=new URL(`${this.url}/${a}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new $e(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,l={},{head:h=!1,get:i=!1,count:c}={}){var u;let f,d=new URL(`${this.url}/rpc/${a}`),p;h||i?(f=h?"HEAD":"GET",Object.entries(l).filter(([y,g])=>g!==void 0).map(([y,g])=>[y,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([y,g])=>{d.searchParams.append(y,g)})):(f="POST",p=l);let m=new Headers(this.headers);return c&&m.set("Prefer",`count=${c}`),new s.default({method:f,url:d,headers:m,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};t.default=n}),tt=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;var e=($(),S(P)),r=e.__importDefault(et());t.PostgrestClient=r.default;var s=e.__importDefault(Se());t.PostgrestQueryBuilder=s.default;var n=e.__importDefault(F());t.PostgrestFilterBuilder=n.default;var o=e.__importDefault(Oe());t.PostgrestTransformBuilder=o.default;var a=e.__importDefault(Pe());t.PostgrestBuilder=a.default;var l=e.__importDefault(_e());t.PostgrestError=l.default,t.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:n.default,PostgrestTransformBuilder:o.default,PostgrestBuilder:a.default,PostgrestError:l.default}});v();v();var Te=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()}};v();v();var rt="nvwa_current_jwt";v();v();var w=class xe{constructor(e){if(this.headerMap=new Map,e){if(e instanceof xe)e.forEach((r,s)=>this.set(s,r));else if(Array.isArray(e))for(let[r,s]of e)this.set(r,String(s));else if(typeof e=="object")for(let r of Object.keys(e))this.set(r,String(e[r]))}}append(e,r){let s=e.toLowerCase(),n=this.headerMap.get(s);this.headerMap.set(s,n?`${n}, ${r}`:r)}set(e,r){this.headerMap.set(e.toLowerCase(),String(r))}get(e){return this.headerMap.get(e.toLowerCase())??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[r,s]of this.headerMap.entries())e(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},je=class Le{constructor(e){if(this.params=new Map,e){if(typeof e=="string")this.parseString(e);else if(e instanceof Le)this.params=new Map(e.params);else if(Array.isArray(e))for(let[r,s]of e)this.append(r,s);else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))this.set(r,s)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let r=e.split("&");for(let s of r)if(s){let[n,o]=s.split("=");n&&this.append(decodeURIComponent(n),o?decodeURIComponent(o):"")}}append(e,r){let s=this.params.get(e)||[];s.push(r),this.params.set(e,s)}delete(e){this.params.delete(e)}get(e){let r=this.params.get(e);return r?r[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,r){this.params.set(e,[r])}sort(){let e=Array.from(this.params.entries()).sort(([r],[s])=>r.localeCompare(s));this.params=new Map(e)}toString(){let e=[];for(let[r,s]of this.params.entries())for(let n of s)e.push(`${encodeURIComponent(r)}=${encodeURIComponent(n)}`);return e.join("&")}forEach(e){for(let[r,s]of this.params.entries())for(let n of s)e(n,r,this)}keys(){return this.params.keys()}values(){let e=[];for(let r of this.params.values())e.push(...r);return e[Symbol.iterator]()}entries(){let e=[];for(let[r,s]of this.params.entries())for(let n of s)e.push([r,n]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},st=class k{constructor(e,r){let s;if(e instanceof k)s=e.href;else if(r){let o=r instanceof k?r.href:r;s=this.resolve(o,e)}else s=e;let n=this.parseUrl(s);this.href=s,this.origin=`${n.protocol}//${n.host}`,this.protocol=n.protocol,this.username=n.username,this.password=n.password,this.host=n.host,this.hostname=n.hostname,this.port=n.port,this.pathname=n.pathname,this.search=n.search,this.searchParams=new je(n.search),this.hash=n.hash}resolve(e,r){if(r.startsWith("http://")||r.startsWith("https://"))return r;if(r.startsWith("//"))return`${this.parseUrl(e).protocol}${r}`;if(r.startsWith("/")){let o=this.parseUrl(e);return`${o.protocol}//${o.host}${r}`}let s=this.parseUrl(e),n=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return`${s.protocol}//${s.host}${n}${r}`}parseUrl(e){let r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!r)throw new TypeError("Invalid URL");let s=r[2]||"",n=r[4]||"",o=r[5]||"/",a=r[7]?`?${r[7]}`:"",l=r[9]?`#${r[9]}`:"";if(!s&&!n&&!o.startsWith("/")&&!o.includes("/")&&!o.includes("."))throw new TypeError("Invalid URL");let h=n.match(/^([^@]*)@(.+)$/),i="",c="",u=n;if(h){let m=h[1];u=h[2];let y=m.match(/^([^:]*):?(.*)$/);y&&(i=y[1]||"",c=y[2]||"")}let f=u.match(/^([^:]+):?(\d*)$/),d=f?f[1]:u,p=f&&f[2]?f[2]:"";return{protocol:s?`${s}:`:"",username:i,password:c,host:u,hostname:d,port:p,pathname:o,search:a,hash:l}}toString(){let e=this.searchParams.toString(),r=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${r}${this.hash}`}toJSON(){return this.toString()}};v();var nt=class Ae{constructor(e,r){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(r?.method||"GET").toUpperCase(),this.headers=r?.headers instanceof w?r.headers:new w(r?.headers),this.body=r?.body,this.timeout=r?.timeout,this.signal=r?.signal||void 0}clone(){return new Ae(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};v();var B=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=ot(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 ot(t){return t?new w(t):new w}v();var Ie=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]"}},at=class{constructor(){this._signal=new Ie}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};v();function Ce(t){t.URL=st,t.URLSearchParams=je,t.Headers=w,t.Request=nt,t.Response=B,t.AbortController=at,t.AbortSignal=Ie}var Ne=class{constructor(t,e,r){console.log("NvwaHttpClient 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(rt),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let n=e?.method||"GET";if((n==="POST"||n==="PUT"||n==="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}};v();var it="/storage",lt=it+"/generateUploadUrl",He=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+lt,{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:n}=await s.json();return{url:n.split("?")[0]}}};v();v();v();var q=Ze(tt(),1),{PostgrestClient:ct,PostgrestQueryBuilder:wt,PostgrestFilterBuilder:bt,PostgrestTransformBuilder:Et,PostgrestBuilder:_t,PostgrestError:Pt}=q.default||q,ht="/entities",Re=(t,e)=>new ct(t+ht,{fetch:e.fetchWithAuth.bind(e)});v();var Me=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/skill/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};v();var Ue=class{constructor(){this.hoverOverlay=null,this.selectedOverlay=null,this.tooltip=null,this.hoverElement=null,this.selectedElement=null,this.hoverUpdateHandler=null,this.selectedUpdateHandler=null,this.createStyles()}createStyles(){if(document.getElementById("__nvwa-inspector-overlay-style"))return;let 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;
|
|
@@ -30,4 +30,4 @@
|
|
|
30
30
|
max-width: 400px;
|
|
31
31
|
word-break: break-all;
|
|
32
32
|
}
|
|
33
|
-
`,document.head.appendChild(t)}createTooltip(){return this.tooltip?this.tooltip:(this.tooltip=document.createElement("div"),this.tooltip.id="__nvwa-inspector-tooltip",document.body.appendChild(this.tooltip),this.tooltip)}createOverlay(t){let e=document.createElement("div");return e.className=`__nvwa-inspector-overlay __nvwa-inspector-overlay-${t}`,document.body.appendChild(e),e}updateOverlayPosition(t,e){if(!e.isConnected)return;let r=e.getBoundingClientRect(),s=window.scrollX||window.pageXOffset,n=window.scrollY||window.pageYOffset;r.width>0&&r.height>0?(t.style.left=`${r.left+s}px`,t.style.top=`${r.top+n}px`,t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.display="block"):t.style.display="none"}removeOverlay(t){t&&t.parentNode&&t.parentNode.removeChild(t)}highlightElement(t,e){if(!t.isConnected)return;if(this.hoverElement===t&&this.hoverOverlay){this.updateOverlayPosition(this.hoverOverlay,t);let a=this.createTooltip();e?a.textContent=e:a.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,a.style.display="block";let l=t.getBoundingClientRect();a.style.left=`${l.left+window.scrollX}px`,a.style.top=`${l.top+window.scrollY-a.offsetHeight-8}px`,l.top<a.offsetHeight+8&&(a.style.top=`${l.bottom+window.scrollY+8}px`);return}this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null);let r=this.createOverlay("hover");this.updateOverlayPosition(r,t),this.hoverOverlay=r,this.hoverElement=t;let s=()=>{this.hoverOverlay&&this.hoverElement&&this.hoverElement.isConnected&&this.updateOverlayPosition(this.hoverOverlay,this.hoverElement)};this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler)),this.hoverUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s);let n=this.createTooltip();e?n.textContent=e:n.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,n.style.display="block";let o=t.getBoundingClientRect();n.style.left=`${o.left+window.scrollX}px`,n.style.top=`${o.top+window.scrollY-n.offsetHeight-8}px`,o.top<n.offsetHeight+8&&(n.style.top=`${o.bottom+window.scrollY+8}px`)}selectElement(t,e){if(!t.isConnected)return;if(this.selectedElement===t&&this.selectedOverlay){this.updateOverlayPosition(this.selectedOverlay,t);return}this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null);let r=this.createOverlay("selected");this.updateOverlayPosition(r,t),this.selectedOverlay=r,this.selectedElement=t;let s=()=>{this.selectedOverlay&&this.selectedElement&&this.selectedElement.isConnected&&this.updateOverlayPosition(this.selectedOverlay,this.selectedElement)};this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler)),this.selectedUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s)}removeHighlight(){this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null),this.hoverElement&&(this.hoverElement=null),this.tooltip&&(this.tooltip.style.display="none"),this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler),this.hoverUpdateHandler=null)}clearSelection(){this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null),this.selectedElement&&(this.selectedElement=null),this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler),this.selectedUpdateHandler=null)}cleanup(){this.removeHighlight(),this.clearSelection(),this.tooltip&&this.tooltip.parentNode&&(this.tooltip.parentNode.removeChild(this.tooltip),this.tooltip=null);let t=document.getElementById("__nvwa-inspector-overlay-style");t&&t.parentNode&&t.parentNode.removeChild(t)}};function ke(t="root"){if(typeof document>"u")return null;let e=document.getElementById(t)||document.body;if(!e)return null;let r=e.querySelector("[data-source-location]");if(r){let s=r.getAttribute("data-source-location");if(s)return s}if(e.firstElementChild){let s=e.firstElementChild.getAttribute("data-source-location");if(s)return s}return null}v();var Ot=typeof fetch<"u"?fetch:(()=>{throw new Error("payment client requires fetch")})();var H=class{constructor(){this.prefix="nvwa_"}getKey(e){return`${this.prefix}${e}`}async get(e){try{let r=this.getKey(e),s=uni.getStorageSync(r);return s?s.expires&&Date.now()>s.expires?(await this.remove(e),null):s.value:null}catch(r){return console.error("UniAppStorageService get error:",r),null}}async set(e,r,s){try{let n=this.getKey(e),o={value:r,expires:s?Date.now()+s*1e3:null,timestamp:Date.now()};uni.setStorageSync(n,o)}catch(n){throw console.error("UniAppStorageService set error:",n),n}}async remove(e){try{let r=this.getKey(e);uni.removeStorageSync(r)}catch(r){throw console.error("UniAppStorageService remove error:",r),r}}async clear(){try{uni.clearStorageSync()}catch(e){throw console.error("UniAppStorageService clear error:",e),e}}};var j=(t,e)=>{let r;if(typeof t=="string")r=t;else if(t&&typeof t.toString=="function")r=t.toString();else if(t?.url)r=t.url;else throw new Error("Invalid input for uniappFetch");let s=(e?.method||"GET").toUpperCase(),n={};if(e?.headers){let l=e.headers;if(typeof l?.forEach=="function")l.forEach((h,i)=>{n[i]=h});else if(Array.isArray(l))for(let[h,i]of l)n[h]=i;else Object.assign(n,l)}let o;if(e?.body!==void 0){let l=e.body;if(typeof l=="string")o=l;else if(l&&typeof l=="object"&&typeof l.forEach=="function"){let h={};l.forEach((i,c)=>{h[c]=i}),o=h}else o=l}let a=e?.timeout||3e4;return new Promise((l,h)=>{let i=e?.signal;if(i?.aborted){let d=new Error("The operation was aborted");d.name="AbortError",h(d);return}let c=!1,u=[],f=uni.request({url:r,method:s,data:o,header:n,timeout:a,success:d=>{if(c)return;c=!0;let p=d.statusCode,m="",y=new w,g=d.header||d.headers||{};Object.keys(g).forEach(b=>{let E=g[b];y.set(b,typeof E=="string"?E:String(E))}),l(new B(d.data,{status:p,statusText:m,headers:y}))},fail:d=>{if(c)return;c=!0;let p=d?.errMsg||d?.message||"Network Error",m=new Error(p);/(abort|aborted|canceled|cancelled)/i.test(String(p))&&(m.name="AbortError"),h(m)}});if(i&&typeof i.addEventListener=="function"){let d=()=>{if(c)return;try{f?.abort?.()}catch{}let p=new Error("The operation was aborted");p.name="AbortError",c=!0,h(p)};i.addEventListener("abort",d),u.push(()=>{try{i.removeEventListener?.("abort",d)}catch{}})}})};typeof globalThis.fetch!="function"&&(globalThis.fetch=j);function ut(){if(typeof window>"u"||window===window.parent)return;let t=!1,e=new Ue;function r(i){if(!i)return!1;let c=i.toLowerCase();return c.includes("/components/")||c.includes("\\components\\")}function s(i){let c=i,u=null;for(;c;){let f=c.getAttribute("data-source-location");if(f)if(r(f)){u||(u=f),c=c.parentElement;continue}else return f;c=c.parentElement}return u}let n=null;function o(i){t&&(n!==null&&cancelAnimationFrame(n),n=requestAnimationFrame(()=>{let c=i.target;if(!c||c===document.body||c===document.documentElement){e.removeHighlight();return}if(c.tagName.toLowerCase()==="img"){let p=s(c);e.highlightElement(c,p);let m={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:p,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(m,"*");return}let u=c,f=s(c);if(!f){let p=c.parentElement;for(;p&&p!==document.body&&p!==document.documentElement;){let m=s(p);if(m){u=p,f=m;break}p=p.parentElement}}e.highlightElement(u,f);let d={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:f,elementInfo:{tagName:u.tagName.toLowerCase(),className:u.className||"",id:u.id||""}};window.parent.postMessage(d,"*")}))}function a(){if(!t)return;e.removeHighlight();let i={type:"HOVER_INSPECTOR_ELEMENT_LEAVE"};window.parent.postMessage(i,"*")}function l(i){if(!t)return;i.preventDefault(),i.stopPropagation();let c=i.target;if(!c||c===document.body||c===document.documentElement)return;let u=s(c);e.selectElement(c,u);let f={type:"HOVER_INSPECTOR_ELEMENT_SELECT",sourceLocation:u,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(f,"*")}function h(i){i.data?.type==="HOVER_INSPECTOR_ENABLE"?(t=!0,document.addEventListener("mousemove",o),document.addEventListener("mouseleave",a),document.addEventListener("click",l,!0)):i.data?.type==="HOVER_INSPECTOR_DISABLE"&&(t=!1,document.removeEventListener("mousemove",o),document.removeEventListener("mouseleave",a),document.removeEventListener("click",l,!0),e.removeHighlight(),e.clearSelection())}return window.addEventListener("message",h),()=>{window.removeEventListener("message",h),document.removeEventListener("mousemove",o),document.removeEventListener("mouseleave",a),document.removeEventListener("click",l,!0),e.cleanup()}}function dt(t,e){if(!t||!t.contentWindow)throw new Error("Invalid iframe element");let r={type:"HOVER_INSPECTOR_ENABLE"};t.contentWindow.postMessage(r,e)}function pt(t,e){if(!t||!t.contentWindow)return;let r={type:"HOVER_INSPECTOR_DISABLE"};t.contentWindow.postMessage(r,e)}function ft(t,e,r=5e3){return new Promise((s,n)=>{if(!t||!t.contentWindow){n(new Error("Invalid iframe element"));return}let o=`source-location-${Date.now()}-${Math.random()}`,a=setTimeout(()=>{window.removeEventListener("message",l),n(new Error("Request timeout"))},r),l=i=>{i.origin===e&&i.data?.type==="GET_SOURCE_LOCATION_RESPONSE"&&i.data?.requestId===o&&(clearTimeout(a),window.removeEventListener("message",l),i.data.error?n(new Error(i.data.error)):s(i.data.sourceLocation||null))};window.addEventListener("message",l);let h={type:"GET_SOURCE_LOCATION_REQUEST",requestId:o};try{t.contentWindow.postMessage(h,e)}catch(i){clearTimeout(a),window.removeEventListener("message",l),n(i)}})}function mt(){if(typeof window>"u"||window===window.parent)return;let t=e=>{if(e.data?.type==="GET_SOURCE_LOCATION_REQUEST")try{let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:yt(),requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}catch(r){let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:null,error:r instanceof Error?r.message:"Unknown error",requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}function yt(){return ke("app")}var De=new H,R=class{constructor(e,r){this.httpClient=new Ne(De,j,r),this.fileStorage=new He(e,this.httpClient),this.entities=Re(e,this.httpClient),this.functions=new Te(this.httpClient),this.skill=new Me(e,this.httpClient)}};0&&(module.exports={disableIframeHoverInspector,enableIframeHoverInspector,getIframeSourceLocation,localStorage,polyfill,setupIframeHoverInspector,setupIframeSourceLocationListener,uniappFetch});
|
|
33
|
+
`,document.head.appendChild(t)}createTooltip(){return this.tooltip?this.tooltip:(this.tooltip=document.createElement("div"),this.tooltip.id="__nvwa-inspector-tooltip",document.body.appendChild(this.tooltip),this.tooltip)}createOverlay(t){let e=document.createElement("div");return e.className=`__nvwa-inspector-overlay __nvwa-inspector-overlay-${t}`,document.body.appendChild(e),e}updateOverlayPosition(t,e){if(!e.isConnected)return;let r=e.getBoundingClientRect(),s=window.scrollX||window.pageXOffset,n=window.scrollY||window.pageYOffset;r.width>0&&r.height>0?(t.style.left=`${r.left+s}px`,t.style.top=`${r.top+n}px`,t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.display="block"):t.style.display="none"}removeOverlay(t){t&&t.parentNode&&t.parentNode.removeChild(t)}highlightElement(t,e){if(!t.isConnected)return;if(this.hoverElement===t&&this.hoverOverlay){this.updateOverlayPosition(this.hoverOverlay,t);let a=this.createTooltip();e?a.textContent=e:a.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,a.style.display="block";let l=t.getBoundingClientRect();a.style.left=`${l.left+window.scrollX}px`,a.style.top=`${l.top+window.scrollY-a.offsetHeight-8}px`,l.top<a.offsetHeight+8&&(a.style.top=`${l.bottom+window.scrollY+8}px`);return}this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null);let r=this.createOverlay("hover");this.updateOverlayPosition(r,t),this.hoverOverlay=r,this.hoverElement=t;let s=()=>{this.hoverOverlay&&this.hoverElement&&this.hoverElement.isConnected&&this.updateOverlayPosition(this.hoverOverlay,this.hoverElement)};this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler)),this.hoverUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s);let n=this.createTooltip();e?n.textContent=e:n.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,n.style.display="block";let o=t.getBoundingClientRect();n.style.left=`${o.left+window.scrollX}px`,n.style.top=`${o.top+window.scrollY-n.offsetHeight-8}px`,o.top<n.offsetHeight+8&&(n.style.top=`${o.bottom+window.scrollY+8}px`)}selectElement(t,e){if(!t.isConnected)return;if(this.selectedElement===t&&this.selectedOverlay){this.updateOverlayPosition(this.selectedOverlay,t);return}this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null);let r=this.createOverlay("selected");this.updateOverlayPosition(r,t),this.selectedOverlay=r,this.selectedElement=t;let s=()=>{this.selectedOverlay&&this.selectedElement&&this.selectedElement.isConnected&&this.updateOverlayPosition(this.selectedOverlay,this.selectedElement)};this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler)),this.selectedUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s)}removeHighlight(){this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null),this.hoverElement&&(this.hoverElement=null),this.tooltip&&(this.tooltip.style.display="none"),this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler),this.hoverUpdateHandler=null)}clearSelection(){this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null),this.selectedElement&&(this.selectedElement=null),this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler),this.selectedUpdateHandler=null)}cleanup(){this.removeHighlight(),this.clearSelection(),this.tooltip&&this.tooltip.parentNode&&(this.tooltip.parentNode.removeChild(this.tooltip),this.tooltip=null);let t=document.getElementById("__nvwa-inspector-overlay-style");t&&t.parentNode&&t.parentNode.removeChild(t)}};function ke(t="root"){if(typeof document>"u")return null;let e=document.getElementById(t)||document.body;if(!e)return null;let r=e.querySelector("[data-source-location]");if(r){let s=r.getAttribute("data-source-location");if(s)return s}if(e.firstElementChild){let s=e.firstElementChild.getAttribute("data-source-location");if(s)return s}return null}v();var Ot=typeof fetch<"u"?fetch:(()=>{throw new Error("payment client requires fetch")})();var H=class{constructor(){this.prefix="nvwa_"}getKey(e){return`${this.prefix}${e}`}async get(e){try{let r=this.getKey(e),s=uni.getStorageSync(r);return s?s.expires&&Date.now()>s.expires?(await this.remove(e),null):s.value:null}catch(r){return console.error("UniAppStorageService get error:",r),null}}async set(e,r,s){try{let n=this.getKey(e),o={value:r,expires:s?Date.now()+s*1e3:null,timestamp:Date.now()};uni.setStorageSync(n,o)}catch(n){throw console.error("UniAppStorageService set error:",n),n}}async remove(e){try{let r=this.getKey(e);uni.removeStorageSync(r)}catch(r){throw console.error("UniAppStorageService remove error:",r),r}}async clear(){try{uni.clearStorageSync()}catch(e){throw console.error("UniAppStorageService clear error:",e),e}}};var j=(t,e)=>{let r;if(typeof t=="string")r=t;else if(t&&typeof t.toString=="function")r=t.toString();else if(t?.url)r=t.url;else throw new Error("Invalid input for uniappFetch");let s=(e?.method||"GET").toUpperCase(),n={};if(e?.headers){let l=e.headers;if(typeof l?.forEach=="function")l.forEach((h,i)=>{n[i]=h});else if(Array.isArray(l))for(let[h,i]of l)n[h]=i;else Object.assign(n,l)}let o;if(e?.body!==void 0){let l=e.body;if(typeof l=="string")o=l;else if(l&&typeof l=="object"&&typeof l.forEach=="function"){let h={};l.forEach((i,c)=>{h[c]=i}),o=h}else o=l}let a=e?.timeout||3e4;return new Promise((l,h)=>{let i=e?.signal;if(i?.aborted){let d=new Error("The operation was aborted");d.name="AbortError",h(d);return}let c=!1,u=[],f=uni.request({url:r,method:s,data:o,header:n,timeout:a,success:d=>{if(c)return;c=!0;let p=d.statusCode,m="",y=new w,g=d.header||d.headers||{};Object.keys(g).forEach(b=>{let E=g[b];y.set(b,typeof E=="string"?E:String(E))}),l(new B(d.data,{status:p,statusText:m,headers:y}))},fail:d=>{if(c)return;c=!0;let p=d?.errMsg||d?.message||"Network Error",m=new Error(p);/(abort|aborted|canceled|cancelled)/i.test(String(p))&&(m.name="AbortError"),h(m)}});if(i&&typeof i.addEventListener=="function"){let d=()=>{if(c)return;try{f?.abort?.()}catch{}let p=new Error("The operation was aborted");p.name="AbortError",c=!0,h(p)};i.addEventListener("abort",d),u.push(()=>{try{i.removeEventListener?.("abort",d)}catch{}})}})};typeof globalThis.fetch!="function"&&(globalThis.fetch=j);function ut(){if(typeof window>"u"||window===window.parent)return;let t=!1,e=new Ue;function r(i){if(!i)return!1;let c=i.toLowerCase();return c.includes("/components/")||c.includes("\\components\\")}function s(i){let c=i,u=null;for(;c;){let f=c.getAttribute("data-source-location");if(f)if(r(f)){u||(u=f),c=c.parentElement;continue}else return f;c=c.parentElement}return u}let n=null;function o(i){t&&(n!==null&&cancelAnimationFrame(n),n=requestAnimationFrame(()=>{let c=i.target;if(!c||c===document.body||c===document.documentElement){e.removeHighlight();return}if(c.tagName.toLowerCase()==="img"){let p=s(c);e.highlightElement(c,p);let m={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:p,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(m,"*");return}let u=c,f=s(c);if(!f){let p=c.parentElement;for(;p&&p!==document.body&&p!==document.documentElement;){let m=s(p);if(m){u=p,f=m;break}p=p.parentElement}}e.highlightElement(u,f);let d={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:f,elementInfo:{tagName:u.tagName.toLowerCase(),className:u.className||"",id:u.id||""}};window.parent.postMessage(d,"*")}))}function a(){if(!t)return;e.removeHighlight();let i={type:"HOVER_INSPECTOR_ELEMENT_LEAVE"};window.parent.postMessage(i,"*")}function l(i){if(!t)return;i.preventDefault(),i.stopPropagation();let c=i.target;if(!c||c===document.body||c===document.documentElement)return;let u=s(c);e.selectElement(c,u);let f={type:"HOVER_INSPECTOR_ELEMENT_SELECT",sourceLocation:u,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(f,"*")}function h(i){i.data?.type==="HOVER_INSPECTOR_ENABLE"?(t=!0,document.addEventListener("mousemove",o),document.addEventListener("mouseleave",a),document.addEventListener("click",l,!0)):i.data?.type==="HOVER_INSPECTOR_DISABLE"&&(t=!1,document.removeEventListener("mousemove",o),document.removeEventListener("mouseleave",a),document.removeEventListener("click",l,!0),e.removeHighlight(),e.clearSelection())}return window.addEventListener("message",h),()=>{window.removeEventListener("message",h),document.removeEventListener("mousemove",o),document.removeEventListener("mouseleave",a),document.removeEventListener("click",l,!0),e.cleanup()}}function dt(t,e){if(!t||!t.contentWindow)throw new Error("Invalid iframe element");let r={type:"HOVER_INSPECTOR_ENABLE"};t.contentWindow.postMessage(r,e)}function pt(t,e){if(!t||!t.contentWindow)return;let r={type:"HOVER_INSPECTOR_DISABLE"};t.contentWindow.postMessage(r,e)}function ft(t,e,r=5e3){return new Promise((s,n)=>{if(!t||!t.contentWindow){n(new Error("Invalid iframe element"));return}let o=`source-location-${Date.now()}-${Math.random()}`,a=setTimeout(()=>{window.removeEventListener("message",l),n(new Error("Request timeout"))},r),l=i=>{i.origin===e&&i.data?.type==="GET_SOURCE_LOCATION_RESPONSE"&&i.data?.requestId===o&&(clearTimeout(a),window.removeEventListener("message",l),i.data.error?n(new Error(i.data.error)):s(i.data.sourceLocation||null))};window.addEventListener("message",l);let h={type:"GET_SOURCE_LOCATION_REQUEST",requestId:o};try{t.contentWindow.postMessage(h,e)}catch(i){clearTimeout(a),window.removeEventListener("message",l),n(i)}})}function mt(){if(typeof window>"u"||window===window.parent)return;let t=e=>{if(e.data?.type==="GET_SOURCE_LOCATION_REQUEST")try{let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:yt(),requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}catch(r){let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:null,error:r instanceof Error?r.message:"Unknown error",requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}function yt(){return ke("app")}var De=new H,R=class{constructor(e,r){this.httpClient=new Ne(De,j,r),this.fileStorage=new He(e,this.httpClient),this.entities=Re(e,this.httpClient),this.functions=new Te(this.httpClient,e),this.skill=new Me(e,this.httpClient)}};0&&(module.exports={disableIframeHoverInspector,enableIframeHoverInspector,getIframeSourceLocation,localStorage,polyfill,setupIframeHoverInspector,setupIframeSourceLocationListener,uniappFetch});
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ke=Object.create,N=Object.defineProperty,De=Object.getOwnPropertyDescriptor,Fe=Object.getOwnPropertyNames,Be=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty,z=(t,e)=>()=>(t&&(e=t(t=0)),e),_=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ze=(t,e)=>{for(var r in e)N(t,r,{get:e[r],enumerable:!0})},G=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Fe(e))!qe.call(t,o)&&o!==r&&N(t,o,{get:()=>e[o],enumerable:!(s=De(e,o))||s.enumerable});return t},Ge=(t,e,r)=>(r=t!=null?ke(Be(t)):{},G(e||!t||!t.__esModule?N(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>G(N({},"__esModule",{value:!0}),t),v=z(()=>{"use strict"}),P={};ze(P,{__addDisposableResource:()=>ye,__assign:()=>T,__asyncDelegator:()=>le,__asyncGenerator:()=>ie,__asyncValues:()=>ce,__await:()=>O,__awaiter:()=>te,__classPrivateFieldGet:()=>pe,__classPrivateFieldIn:()=>me,__classPrivateFieldSet:()=>fe,__createBinding:()=>x,__decorate:()=>K,__disposeResources:()=>ve,__esDecorate:()=>Q,__exportStar:()=>se,__extends:()=>W,__generator:()=>re,__importDefault:()=>de,__importStar:()=>ue,__makeTemplateObject:()=>he,__metadata:()=>ee,__param:()=>J,__propKey:()=>X,__read:()=>k,__rest:()=>V,__rewriteRelativeImportExtension:()=>ge,__runInitializers:()=>Y,__setFunctionName:()=>Z,__spread:()=>ne,__spreadArray:()=>ae,__spreadArrays:()=>oe,__values:()=>A,default:()=>Ee});function W(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");j(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function V(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(r[s[o]]=t[s[o]]);return r}function K(t,e,r,s){var o=arguments.length,n=o<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,r,s);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(n=(o<3?a(n):o>3?a(e,r,n):a(e,r))||n);return o>3&&n&&Object.defineProperty(e,r,n),n}function J(t,e){return function(r,s){e(r,s,t)}}function Q(t,e,r,s,o,n){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var l=s.kind,h=l==="getter"?"get":l==="setter"?"set":"value",i=!e&&t?s.static?t:t.prototype:null,c=e||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),u,f=!1,d=r.length-1;d>=0;d--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(g||null))};var y=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[h],p);if(l==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(u=a(y.get))&&(c.get=u),(u=a(y.set))&&(c.set=u),(u=a(y.init))&&o.unshift(u)}else(u=a(y))&&(l==="field"?o.unshift(u):c[h]=u)}i&&Object.defineProperty(i,s.name,c),f=!0}function Y(t,e,r){for(var s=arguments.length>2,o=0;o<e.length;o++)r=s?e[o].call(t,r):e[o].call(t);return s?r:void 0}function X(t){return typeof t=="symbol"?t:"".concat(t)}function Z(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function ee(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function te(t,e,r,s){function o(n){return n instanceof r?n:new r(function(a){a(n)})}return new(r||(r=Promise))(function(n,a){function l(c){try{i(s.next(c))}catch(u){a(u)}}function h(c){try{i(s.throw(c))}catch(u){a(u)}}function i(c){c.done?n(c.value):o(c.value).then(l,h)}i((s=s.apply(t,e||[])).next())})}function re(t,e){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,o,n,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(i){return function(c){return h([i,c])}}function h(i){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(r=0)),r;)try{if(s=1,o&&(n=i[0]&2?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:n=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,o=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label<n[1]){r.label=n[1],n=i;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(i);break}n[2]&&r.ops.pop(),r.trys.pop();continue}i=e.call(t,r)}catch(c){i=[6,c],o=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function se(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&x(e,t,r)}function A(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),o,n=[],a;try{for(;(e===void 0||e-- >0)&&!(o=s.next()).done;)n.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return n}function ne(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(k(arguments[e]));return t}function oe(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),o=0,e=0;e<r;e++)for(var n=arguments[e],a=0,l=n.length;a<l;a++,o++)s[o]=n[a];return s}function ae(t,e,r){if(r||arguments.length===2)for(var s=0,o=e.length,n;s<o;s++)(n||!(s in e))&&(n||(n=Array.prototype.slice.call(e,0,s)),n[s]=e[s]);return t.concat(n||Array.prototype.slice.call(e))}function O(t){return this instanceof O?(this.v=t,this):new O(t)}function ie(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),o,n=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(d){return function(p){return Promise.resolve(p).then(d,u)}}function l(d,p){s[d]&&(o[d]=function(m){return new Promise(function(y,g){n.push([d,m,y,g])>1||h(d,m)})},p&&(o[d]=p(o[d])))}function h(d,p){try{i(s[d](p))}catch(m){f(n[0][3],m)}}function i(d){d.value instanceof O?Promise.resolve(d.value.v).then(c,u):f(n[0][2],d)}function c(d){h("next",d)}function u(d){h("throw",d)}function f(d,p){d(p),n.shift(),n.length&&h(n[0][0],n[0][1])}}function le(t){var e,r;return e={},s("next"),s("throw",function(o){throw o}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(o,n){e[o]=t[o]?function(a){return(r=!r)?{value:O(t[o](a)),done:!1}:n?n(a):a}:n}}function ce(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof A=="function"?A(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=t[n]&&function(a){return new Promise(function(l,h){a=t[n](a),o(l,h,a.done,a.value)})}}function o(n,a,l,h){Promise.resolve(h).then(function(i){n({value:i,done:l})},a)}}function he(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ue(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=L(t),s=0;s<r.length;s++)r[s]!=="default"&&x(e,t,r[s]);return we(e,t),e}function de(t){return t&&t.__esModule?t:{default:t}}function pe(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function fe(t,e,r,s,o){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function me(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function ye(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(o=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");o&&(s=function(){try{o.call(this)}catch(n){return Promise.reject(n)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function ve(t){function e(n){t.error=t.hasError?new be(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}var r,s=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(o,function(a){return e(a),o()})}else s|=1}catch(a){e(a)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}function ge(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,o,n,a){return s?e?".jsx":".js":o&&(!n||!a)?r:o+n+"."+a.toLowerCase()+"js"}):t}var j,T,x,we,L,be,Ee,$=z(()=>{"use strict";v(),j=function(t,e){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},j(t,e)},T=function(){return T=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},T.apply(this,arguments)},x=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,o)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),we=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},L=function(t){return L=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},L(t)},be=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s},Ee={__extends:W,__assign:T,__rest:V,__decorate:K,__param:J,__esDecorate:Q,__runInitializers:Y,__propKey:X,__setFunctionName:Z,__metadata:ee,__awaiter:te,__generator:re,__createBinding:x,__exportStar:se,__values:A,__read:k,__spread:ne,__spreadArrays:oe,__spreadArray:ae,__await:O,__asyncGenerator:ie,__asyncDelegator:le,__asyncValues:ce,__makeTemplateObject:he,__importStar:ue,__importDefault:de,__classPrivateFieldGet:pe,__classPrivateFieldSet:fe,__classPrivateFieldIn:me,__addDisposableResource:ye,__disposeResources:ve,__rewriteRelativeImportExtension:ge}}),_e=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};t.default=e}),Pe=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(_e()),s=class{constructor(o){var n,a;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(n=o.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,n){return this.headers=new Headers(this.headers),this.headers.set(o,n),this}then(o,n){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 a=this.fetch,l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async h=>{var i,c,u,f;let d=null,p=null,m=null,y=h.status,g=h.statusText;if(h.ok){if(this.method!=="HEAD"){let M=await h.text();M===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text")?p=M:p=JSON.parse(M))}let b=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),E=(u=h.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&E&&E.length>1&&(m=parseInt(E[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(d={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,m=null,y=406,g="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let b=await h.text();try{d=JSON.parse(b),Array.isArray(d)&&h.status===404&&(p=[],d=null,y=200,g="OK")}catch{h.status===404&&b===""?(y=204,g="No Content"):d={message:b}}if(d&&this.isMaybeSingle&&!((f=d?.details)===null||f===void 0)&&f.includes("0 rows")&&(d=null,y=200,g="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:p,count:m,status:y,statusText:g}});return this.shouldThrowOnError||(l=l.catch(h=>{var i,c,u;return{error:{message:`${(i=h?.name)!==null&&i!==void 0?i:"FetchError"}: ${h?.message}`,details:`${(c=h?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(u=h?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),l.then(o,n)}returns(){return this}overrideTypes(){return this}};t.default=s}),Oe=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Pe()),s=class extends r.default{select(o){let n=!1,a=(o??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(o,{ascending:n=!0,nullsFirst:a,foreignTable:l,referencedTable:h=l}={}){let i=h?`${h}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${o}.${n?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(o,{foreignTable:n,referencedTable:a=n}={}){let l=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${o}`),this}range(o,n,{foreignTable:a,referencedTable:l=a}={}){let h=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(h,`${o}`),this.url.searchParams.set(i,`${n-o+1}`),this}abortSignal(o){return this.signal=o,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:o=!1,verbose:n=!1,settings:a=!1,buffers:l=!1,wal:h=!1,format:i="text"}={}){var c;let u=[o?"analyze":null,n?"verbose":null,a?"settings":null,l?"buffers":null,h?"wal":null].filter(Boolean).join("|"),f=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${f}"; options=${u};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(o){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${o}`),this}};t.default=s}),D=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Oe()),s=new RegExp("[,()]"),o=class extends r.default{eq(n,a){return this.url.searchParams.append(n,`eq.${a}`),this}neq(n,a){return this.url.searchParams.append(n,`neq.${a}`),this}gt(n,a){return this.url.searchParams.append(n,`gt.${a}`),this}gte(n,a){return this.url.searchParams.append(n,`gte.${a}`),this}lt(n,a){return this.url.searchParams.append(n,`lt.${a}`),this}lte(n,a){return this.url.searchParams.append(n,`lte.${a}`),this}like(n,a){return this.url.searchParams.append(n,`like.${a}`),this}likeAllOf(n,a){return this.url.searchParams.append(n,`like(all).{${a.join(",")}}`),this}likeAnyOf(n,a){return this.url.searchParams.append(n,`like(any).{${a.join(",")}}`),this}ilike(n,a){return this.url.searchParams.append(n,`ilike.${a}`),this}ilikeAllOf(n,a){return this.url.searchParams.append(n,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(n,a){return this.url.searchParams.append(n,`ilike(any).{${a.join(",")}}`),this}is(n,a){return this.url.searchParams.append(n,`is.${a}`),this}in(n,a){let l=Array.from(new Set(a)).map(h=>typeof h=="string"&&s.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cs.{${a.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(a)}`),this}containedBy(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cd.{${a.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(a)}`),this}rangeGt(n,a){return this.url.searchParams.append(n,`sr.${a}`),this}rangeGte(n,a){return this.url.searchParams.append(n,`nxl.${a}`),this}rangeLt(n,a){return this.url.searchParams.append(n,`sl.${a}`),this}rangeLte(n,a){return this.url.searchParams.append(n,`nxr.${a}`),this}rangeAdjacent(n,a){return this.url.searchParams.append(n,`adj.${a}`),this}overlaps(n,a){return typeof a=="string"?this.url.searchParams.append(n,`ov.${a}`):this.url.searchParams.append(n,`ov.{${a.join(",")}}`),this}textSearch(n,a,{config:l,type:h}={}){let i="";h==="plain"?i="pl":h==="phrase"?i="ph":h==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${a}`),this}match(n){return Object.entries(n).forEach(([a,l])=>{this.url.searchParams.append(a,`eq.${l}`)}),this}not(n,a,l){return this.url.searchParams.append(n,`not.${a}.${l}`),this}or(n,{foreignTable:a,referencedTable:l=a}={}){let h=l?`${l}.or`:"or";return this.url.searchParams.append(h,`(${n})`),this}filter(n,a,l){return this.url.searchParams.append(n,`${a}.${l}`),this}};t.default=o}),Se=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(D()),s=class{constructor(o,{headers:n={},schema:a,fetch:l}){this.url=o,this.headers=new Headers(n),this.schema=a,this.fetch=l}select(o,n){let{head:a=!1,count:l}=n??{},h=a?"HEAD":"GET",i=!1,c=(o??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(o,{count:n,defaultToNull:a=!0}={}){var l;let h="POST";if(n&&this.headers.append("Prefer",`count=${n}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let i=o.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(i.length>0){let c=[...new Set(i)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(o,{onConflict:n,ignoreDuplicates:a=!1,count:l,defaultToNull:h=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let u=o.reduce((f,d)=>f.concat(Object.keys(d)),[]);if(u.length>0){let f=[...new Set(u)].map(d=>`"${d}"`);this.url.searchParams.set("columns",f.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(o,{count:n}={}){var a;let l="PATCH";return n&&this.headers.append("Prefer",`count=${n}`),new r.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:o}={}){var n;let a="DELETE";return o&&this.headers.append("Prefer",`count=${o}`),new r.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};t.default=s}),We=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Se()),s=e.__importDefault(D()),o=class $e{constructor(a,{headers:l={},schema:h,fetch:i}={}){this.url=a,this.headers=new Headers(l),this.schemaName=h,this.fetch=i}from(a){let l=new URL(`${this.url}/${a}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new $e(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,l={},{head:h=!1,get:i=!1,count:c}={}){var u;let f,d=new URL(`${this.url}/rpc/${a}`),p;h||i?(f=h?"HEAD":"GET",Object.entries(l).filter(([y,g])=>g!==void 0).map(([y,g])=>[y,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([y,g])=>{d.searchParams.append(y,g)})):(f="POST",p=l);let m=new Headers(this.headers);return c&&m.set("Prefer",`count=${c}`),new s.default({method:f,url:d,headers:m,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};t.default=o}),Ve=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;var e=($(),S(P)),r=e.__importDefault(We());t.PostgrestClient=r.default;var s=e.__importDefault(Se());t.PostgrestQueryBuilder=s.default;var o=e.__importDefault(D());t.PostgrestFilterBuilder=o.default;var n=e.__importDefault(Oe());t.PostgrestTransformBuilder=n.default;var a=e.__importDefault(Pe());t.PostgrestBuilder=a.default;var l=e.__importDefault(_e());t.PostgrestError=l.default,t.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:o.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:a.default,PostgrestError:l.default}});v();v();var Te=class{constructor(t){this.http=t}async invoke(t,e){return await(await this.http.fetch("/functions/"+t,{method:e.method||"POST",body:e.body,headers:e.headers})).json()}};v();v();var Ke="nvwa_current_jwt";v();v();var w=class xe{constructor(e){if(this.headerMap=new Map,e){if(e instanceof xe)e.forEach((r,s)=>this.set(s,r));else if(Array.isArray(e))for(let[r,s]of e)this.set(r,String(s));else if(typeof e=="object")for(let r of Object.keys(e))this.set(r,String(e[r]))}}append(e,r){let s=e.toLowerCase(),o=this.headerMap.get(s);this.headerMap.set(s,o?`${o}, ${r}`:r)}set(e,r){this.headerMap.set(e.toLowerCase(),String(r))}get(e){return this.headerMap.get(e.toLowerCase())??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[r,s]of this.headerMap.entries())e(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},je=class Le{constructor(e){if(this.params=new Map,e){if(typeof e=="string")this.parseString(e);else if(e instanceof Le)this.params=new Map(e.params);else if(Array.isArray(e))for(let[r,s]of e)this.append(r,s);else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))this.set(r,s)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let r=e.split("&");for(let s of r)if(s){let[o,n]=s.split("=");o&&this.append(decodeURIComponent(o),n?decodeURIComponent(n):"")}}append(e,r){let s=this.params.get(e)||[];s.push(r),this.params.set(e,s)}delete(e){this.params.delete(e)}get(e){let r=this.params.get(e);return r?r[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,r){this.params.set(e,[r])}sort(){let e=Array.from(this.params.entries()).sort(([r],[s])=>r.localeCompare(s));this.params=new Map(e)}toString(){let e=[];for(let[r,s]of this.params.entries())for(let o of s)e.push(`${encodeURIComponent(r)}=${encodeURIComponent(o)}`);return e.join("&")}forEach(e){for(let[r,s]of this.params.entries())for(let o of s)e(o,r,this)}keys(){return this.params.keys()}values(){let e=[];for(let r of this.params.values())e.push(...r);return e[Symbol.iterator]()}entries(){let e=[];for(let[r,s]of this.params.entries())for(let o of s)e.push([r,o]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},Je=class U{constructor(e,r){let s;if(e instanceof U)s=e.href;else if(r){let n=r instanceof U?r.href:r;s=this.resolve(n,e)}else s=e;let o=this.parseUrl(s);this.href=s,this.origin=`${o.protocol}//${o.host}`,this.protocol=o.protocol,this.username=o.username,this.password=o.password,this.host=o.host,this.hostname=o.hostname,this.port=o.port,this.pathname=o.pathname,this.search=o.search,this.searchParams=new je(o.search),this.hash=o.hash}resolve(e,r){if(r.startsWith("http://")||r.startsWith("https://"))return r;if(r.startsWith("//"))return`${this.parseUrl(e).protocol}${r}`;if(r.startsWith("/")){let n=this.parseUrl(e);return`${n.protocol}//${n.host}${r}`}let s=this.parseUrl(e),o=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return`${s.protocol}//${s.host}${o}${r}`}parseUrl(e){let r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!r)throw new TypeError("Invalid URL");let s=r[2]||"",o=r[4]||"",n=r[5]||"/",a=r[7]?`?${r[7]}`:"",l=r[9]?`#${r[9]}`:"";if(!s&&!o&&!n.startsWith("/")&&!n.includes("/")&&!n.includes("."))throw new TypeError("Invalid URL");let h=o.match(/^([^@]*)@(.+)$/),i="",c="",u=o;if(h){let m=h[1];u=h[2];let y=m.match(/^([^:]*):?(.*)$/);y&&(i=y[1]||"",c=y[2]||"")}let f=u.match(/^([^:]+):?(\d*)$/),d=f?f[1]:u,p=f&&f[2]?f[2]:"";return{protocol:s?`${s}:`:"",username:i,password:c,host:u,hostname:d,port:p,pathname:n,search:a,hash:l}}toString(){let e=this.searchParams.toString(),r=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${r}${this.hash}`}toJSON(){return this.toString()}};v();var Qe=class Ae{constructor(e,r){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(r?.method||"GET").toUpperCase(),this.headers=r?.headers instanceof w?r.headers:new w(r?.headers),this.body=r?.body,this.timeout=r?.timeout,this.signal=r?.signal||void 0}clone(){return new Ae(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};v();var F=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=Ye(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 Ye(t){return t?new w(t):new w}v();var Ie=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]"}},Xe=class{constructor(){this._signal=new Ie}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};v();function Ze(t){t.URL=Je,t.URLSearchParams=je,t.Headers=w,t.Request=Qe,t.Response=F,t.AbortController=Xe,t.AbortSignal=Ie}var Ce=class{constructor(t,e,r){console.log("NvwaHttpClient 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(Ke),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let o=e?.method||"GET";if((o==="POST"||o==="PUT"||o==="PATCH")&&e?.body){let a=s.get("Content-Type");(!a||a.includes("text/plain"))&&s.set("Content-Type","application/json")}let n=await this.customFetch(t,{...e,headers:s});if(n.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return n}};v();var et="/storage",tt=et+"/generateUploadUrl",Ne=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+tt,{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:o}=await s.json();return{url:o.split("?")[0]}}};v();v();v();var q=Ge(Ve(),1),{PostgrestClient:rt,PostgrestQueryBuilder:at,PostgrestFilterBuilder:it,PostgrestTransformBuilder:lt,PostgrestBuilder:ct,PostgrestError:ht}=q.default||q,st="/entities",He=(t,e)=>new rt(t+st,{fetch:e.fetchWithAuth.bind(e)});v();var Re=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/skill/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};v();var Me=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 ke=Object.create,N=Object.defineProperty,De=Object.getOwnPropertyDescriptor,Fe=Object.getOwnPropertyNames,Be=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty,z=(t,e)=>()=>(t&&(e=t(t=0)),e),_=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ze=(t,e)=>{for(var r in e)N(t,r,{get:e[r],enumerable:!0})},G=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Fe(e))!qe.call(t,o)&&o!==r&&N(t,o,{get:()=>e[o],enumerable:!(s=De(e,o))||s.enumerable});return t},Ge=(t,e,r)=>(r=t!=null?ke(Be(t)):{},G(e||!t||!t.__esModule?N(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>G(N({},"__esModule",{value:!0}),t),v=z(()=>{"use strict"}),P={};ze(P,{__addDisposableResource:()=>ye,__assign:()=>T,__asyncDelegator:()=>le,__asyncGenerator:()=>ie,__asyncValues:()=>ce,__await:()=>O,__awaiter:()=>te,__classPrivateFieldGet:()=>pe,__classPrivateFieldIn:()=>me,__classPrivateFieldSet:()=>fe,__createBinding:()=>x,__decorate:()=>K,__disposeResources:()=>ve,__esDecorate:()=>Q,__exportStar:()=>se,__extends:()=>W,__generator:()=>re,__importDefault:()=>de,__importStar:()=>ue,__makeTemplateObject:()=>he,__metadata:()=>ee,__param:()=>J,__propKey:()=>X,__read:()=>k,__rest:()=>V,__rewriteRelativeImportExtension:()=>ge,__runInitializers:()=>Y,__setFunctionName:()=>Z,__spread:()=>ne,__spreadArray:()=>ae,__spreadArrays:()=>oe,__values:()=>A,default:()=>Ee});function W(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");j(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function V(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(t);o<s.length;o++)e.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(t,s[o])&&(r[s[o]]=t[s[o]]);return r}function K(t,e,r,s){var o=arguments.length,n=o<3?e:s===null?s=Object.getOwnPropertyDescriptor(e,r):s,a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(t,e,r,s);else for(var l=t.length-1;l>=0;l--)(a=t[l])&&(n=(o<3?a(n):o>3?a(e,r,n):a(e,r))||n);return o>3&&n&&Object.defineProperty(e,r,n),n}function J(t,e){return function(r,s){e(r,s,t)}}function Q(t,e,r,s,o,n){function a(g){if(g!==void 0&&typeof g!="function")throw new TypeError("Function expected");return g}for(var l=s.kind,h=l==="getter"?"get":l==="setter"?"set":"value",i=!e&&t?s.static?t:t.prototype:null,c=e||(i?Object.getOwnPropertyDescriptor(i,s.name):{}),u,f=!1,d=r.length-1;d>=0;d--){var p={};for(var m in s)p[m]=m==="access"?{}:s[m];for(var m in s.access)p.access[m]=s.access[m];p.addInitializer=function(g){if(f)throw new TypeError("Cannot add initializers after decoration has completed");n.push(a(g||null))};var y=(0,r[d])(l==="accessor"?{get:c.get,set:c.set}:c[h],p);if(l==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(u=a(y.get))&&(c.get=u),(u=a(y.set))&&(c.set=u),(u=a(y.init))&&o.unshift(u)}else(u=a(y))&&(l==="field"?o.unshift(u):c[h]=u)}i&&Object.defineProperty(i,s.name,c),f=!0}function Y(t,e,r){for(var s=arguments.length>2,o=0;o<e.length;o++)r=s?e[o].call(t,r):e[o].call(t);return s?r:void 0}function X(t){return typeof t=="symbol"?t:"".concat(t)}function Z(t,e,r){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function ee(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)}function te(t,e,r,s){function o(n){return n instanceof r?n:new r(function(a){a(n)})}return new(r||(r=Promise))(function(n,a){function l(c){try{i(s.next(c))}catch(u){a(u)}}function h(c){try{i(s.throw(c))}catch(u){a(u)}}function i(c){c.done?n(c.value):o(c.value).then(l,h)}i((s=s.apply(t,e||[])).next())})}function re(t,e){var r={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},s,o,n,a=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return a.next=l(0),a.throw=l(1),a.return=l(2),typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function l(i){return function(c){return h([i,c])}}function h(i){if(s)throw new TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(r=0)),r;)try{if(s=1,o&&(n=i[0]&2?o.return:i[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,i[1])).done)return n;switch(o=0,n&&(i=[i[0]&2,n.value]),i[0]){case 0:case 1:n=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,o=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(n=r.trys,!(n=n.length>0&&n[n.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!n||i[1]>n[0]&&i[1]<n[3])){r.label=i[1];break}if(i[0]===6&&r.label<n[1]){r.label=n[1],n=i;break}if(n&&r.label<n[2]){r.label=n[2],r.ops.push(i);break}n[2]&&r.ops.pop(),r.trys.pop();continue}i=e.call(t,r)}catch(c){i=[6,c],o=0}finally{s=n=0}if(i[0]&5)throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}function se(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&x(e,t,r)}function A(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function k(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),o,n=[],a;try{for(;(e===void 0||e-- >0)&&!(o=s.next()).done;)n.push(o.value)}catch(l){a={error:l}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return n}function ne(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(k(arguments[e]));return t}function oe(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var s=Array(t),o=0,e=0;e<r;e++)for(var n=arguments[e],a=0,l=n.length;a<l;a++,o++)s[o]=n[a];return s}function ae(t,e,r){if(r||arguments.length===2)for(var s=0,o=e.length,n;s<o;s++)(n||!(s in e))&&(n||(n=Array.prototype.slice.call(e,0,s)),n[s]=e[s]);return t.concat(n||Array.prototype.slice.call(e))}function O(t){return this instanceof O?(this.v=t,this):new O(t)}function ie(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var s=r.apply(t,e||[]),o,n=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(d){return function(p){return Promise.resolve(p).then(d,u)}}function l(d,p){s[d]&&(o[d]=function(m){return new Promise(function(y,g){n.push([d,m,y,g])>1||h(d,m)})},p&&(o[d]=p(o[d])))}function h(d,p){try{i(s[d](p))}catch(m){f(n[0][3],m)}}function i(d){d.value instanceof O?Promise.resolve(d.value.v).then(c,u):f(n[0][2],d)}function c(d){h("next",d)}function u(d){h("throw",d)}function f(d,p){d(p),n.shift(),n.length&&h(n[0][0],n[0][1])}}function le(t){var e,r;return e={},s("next"),s("throw",function(o){throw o}),s("return"),e[Symbol.iterator]=function(){return this},e;function s(o,n){e[o]=t[o]?function(a){return(r=!r)?{value:O(t[o](a)),done:!1}:n?n(a):a}:n}}function ce(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof A=="function"?A(t):t[Symbol.iterator](),r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r);function s(n){r[n]=t[n]&&function(a){return new Promise(function(l,h){a=t[n](a),o(l,h,a.done,a.value)})}}function o(n,a,l,h){Promise.resolve(h).then(function(i){n({value:i,done:l})},a)}}function he(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function ue(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r=L(t),s=0;s<r.length;s++)r[s]!=="default"&&x(e,t,r[s]);return we(e,t),e}function de(t){return t&&t.__esModule?t:{default:t}}function pe(t,e,r,s){if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?s:r==="a"?s.call(t):s?s.value:e.get(t)}function fe(t,e,r,s,o){if(s==="m")throw new TypeError("Private method is not writable");if(s==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s==="a"?o.call(t,r):o?o.value=r:e.set(t,r),r}function me(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function ye(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var s,o;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");s=e[Symbol.asyncDispose]}if(s===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");s=e[Symbol.dispose],r&&(o=s)}if(typeof s!="function")throw new TypeError("Object not disposable.");o&&(s=function(){try{o.call(this)}catch(n){return Promise.reject(n)}}),t.stack.push({value:e,dispose:s,async:r})}else r&&t.stack.push({async:!0});return e}function ve(t){function e(n){t.error=t.hasError?new be(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}var r,s=0;function o(){for(;r=t.stack.pop();)try{if(!r.async&&s===1)return s=0,t.stack.push(r),Promise.resolve().then(o);if(r.dispose){var n=r.dispose.call(r.value);if(r.async)return s|=2,Promise.resolve(n).then(o,function(a){return e(a),o()})}else s|=1}catch(a){e(a)}if(s===1)return t.hasError?Promise.reject(t.error):Promise.resolve();if(t.hasError)throw t.error}return o()}function ge(t,e){return typeof t=="string"&&/^\.\.?\//.test(t)?t.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(r,s,o,n,a){return s?e?".jsx":".js":o&&(!n||!a)?r:o+n+"."+a.toLowerCase()+"js"}):t}var j,T,x,we,L,be,Ee,$=z(()=>{"use strict";v(),j=function(t,e){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},j(t,e)},T=function(){return T=Object.assign||function(t){for(var e,r=1,s=arguments.length;r<s;r++){e=arguments[r];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])}return t},T.apply(this,arguments)},x=Object.create?(function(t,e,r,s){s===void 0&&(s=r);var o=Object.getOwnPropertyDescriptor(e,r);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,s,o)}):(function(t,e,r,s){s===void 0&&(s=r),t[s]=e[r]}),we=Object.create?(function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}):function(t,e){t.default=e},L=function(t){return L=Object.getOwnPropertyNames||function(e){var r=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(r[r.length]=s);return r},L(t)},be=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var s=new Error(r);return s.name="SuppressedError",s.error=t,s.suppressed=e,s},Ee={__extends:W,__assign:T,__rest:V,__decorate:K,__param:J,__esDecorate:Q,__runInitializers:Y,__propKey:X,__setFunctionName:Z,__metadata:ee,__awaiter:te,__generator:re,__createBinding:x,__exportStar:se,__values:A,__read:k,__spread:ne,__spreadArrays:oe,__spreadArray:ae,__await:O,__asyncGenerator:ie,__asyncDelegator:le,__asyncValues:ce,__makeTemplateObject:he,__importStar:ue,__importDefault:de,__classPrivateFieldGet:pe,__classPrivateFieldSet:fe,__classPrivateFieldIn:me,__addDisposableResource:ye,__disposeResources:ve,__rewriteRelativeImportExtension:ge}}),_e=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=class extends Error{constructor(r){super(r.message),this.name="PostgrestError",this.details=r.details,this.hint=r.hint,this.code=r.code}};t.default=e}),Pe=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(_e()),s=class{constructor(o){var n,a;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(n=o.shouldThrowOnError)!==null&&n!==void 0?n:!1,this.signal=o.signal,this.isMaybeSingle=(a=o.isMaybeSingle)!==null&&a!==void 0?a:!1,o.fetch?this.fetch=o.fetch:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,n){return this.headers=new Headers(this.headers),this.headers.set(o,n),this}then(o,n){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 a=this.fetch,l=a(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async h=>{var i,c,u,f;let d=null,p=null,m=null,y=h.status,g=h.statusText;if(h.ok){if(this.method!=="HEAD"){let M=await h.text();M===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&!((i=this.headers.get("Accept"))===null||i===void 0)&&i.includes("application/vnd.pgrst.plan+text")?p=M:p=JSON.parse(M))}let b=(c=this.headers.get("Prefer"))===null||c===void 0?void 0:c.match(/count=(exact|planned|estimated)/),E=(u=h.headers.get("content-range"))===null||u===void 0?void 0:u.split("/");b&&E&&E.length>1&&(m=parseInt(E[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(p)&&(p.length>1?(d={code:"PGRST116",details:`Results contain ${p.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},p=null,m=null,y=406,g="Not Acceptable"):p.length===1?p=p[0]:p=null)}else{let b=await h.text();try{d=JSON.parse(b),Array.isArray(d)&&h.status===404&&(p=[],d=null,y=200,g="OK")}catch{h.status===404&&b===""?(y=204,g="No Content"):d={message:b}}if(d&&this.isMaybeSingle&&!((f=d?.details)===null||f===void 0)&&f.includes("0 rows")&&(d=null,y=200,g="OK"),d&&this.shouldThrowOnError)throw new r.default(d)}return{error:d,data:p,count:m,status:y,statusText:g}});return this.shouldThrowOnError||(l=l.catch(h=>{var i,c,u;return{error:{message:`${(i=h?.name)!==null&&i!==void 0?i:"FetchError"}: ${h?.message}`,details:`${(c=h?.stack)!==null&&c!==void 0?c:""}`,hint:"",code:`${(u=h?.code)!==null&&u!==void 0?u:""}`},data:null,count:null,status:0,statusText:""}})),l.then(o,n)}returns(){return this}overrideTypes(){return this}};t.default=s}),Oe=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Pe()),s=class extends r.default{select(o){let n=!1,a=(o??"*").split("").map(l=>/\s/.test(l)&&!n?"":(l==='"'&&(n=!n),l)).join("");return this.url.searchParams.set("select",a),this.headers.append("Prefer","return=representation"),this}order(o,{ascending:n=!0,nullsFirst:a,foreignTable:l,referencedTable:h=l}={}){let i=h?`${h}.order`:"order",c=this.url.searchParams.get(i);return this.url.searchParams.set(i,`${c?`${c},`:""}${o}.${n?"asc":"desc"}${a===void 0?"":a?".nullsfirst":".nullslast"}`),this}limit(o,{foreignTable:n,referencedTable:a=n}={}){let l=typeof a>"u"?"limit":`${a}.limit`;return this.url.searchParams.set(l,`${o}`),this}range(o,n,{foreignTable:a,referencedTable:l=a}={}){let h=typeof l>"u"?"offset":`${l}.offset`,i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(h,`${o}`),this.url.searchParams.set(i,`${n-o+1}`),this}abortSignal(o){return this.signal=o,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:o=!1,verbose:n=!1,settings:a=!1,buffers:l=!1,wal:h=!1,format:i="text"}={}){var c;let u=[o?"analyze":null,n?"verbose":null,a?"settings":null,l?"buffers":null,h?"wal":null].filter(Boolean).join("|"),f=(c=this.headers.get("Accept"))!==null&&c!==void 0?c:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${i}; for="${f}"; options=${u};`),i==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(o){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${o}`),this}};t.default=s}),D=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Oe()),s=new RegExp("[,()]"),o=class extends r.default{eq(n,a){return this.url.searchParams.append(n,`eq.${a}`),this}neq(n,a){return this.url.searchParams.append(n,`neq.${a}`),this}gt(n,a){return this.url.searchParams.append(n,`gt.${a}`),this}gte(n,a){return this.url.searchParams.append(n,`gte.${a}`),this}lt(n,a){return this.url.searchParams.append(n,`lt.${a}`),this}lte(n,a){return this.url.searchParams.append(n,`lte.${a}`),this}like(n,a){return this.url.searchParams.append(n,`like.${a}`),this}likeAllOf(n,a){return this.url.searchParams.append(n,`like(all).{${a.join(",")}}`),this}likeAnyOf(n,a){return this.url.searchParams.append(n,`like(any).{${a.join(",")}}`),this}ilike(n,a){return this.url.searchParams.append(n,`ilike.${a}`),this}ilikeAllOf(n,a){return this.url.searchParams.append(n,`ilike(all).{${a.join(",")}}`),this}ilikeAnyOf(n,a){return this.url.searchParams.append(n,`ilike(any).{${a.join(",")}}`),this}is(n,a){return this.url.searchParams.append(n,`is.${a}`),this}in(n,a){let l=Array.from(new Set(a)).map(h=>typeof h=="string"&&s.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(n,`in.(${l})`),this}contains(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cs.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cs.{${a.join(",")}}`):this.url.searchParams.append(n,`cs.${JSON.stringify(a)}`),this}containedBy(n,a){return typeof a=="string"?this.url.searchParams.append(n,`cd.${a}`):Array.isArray(a)?this.url.searchParams.append(n,`cd.{${a.join(",")}}`):this.url.searchParams.append(n,`cd.${JSON.stringify(a)}`),this}rangeGt(n,a){return this.url.searchParams.append(n,`sr.${a}`),this}rangeGte(n,a){return this.url.searchParams.append(n,`nxl.${a}`),this}rangeLt(n,a){return this.url.searchParams.append(n,`sl.${a}`),this}rangeLte(n,a){return this.url.searchParams.append(n,`nxr.${a}`),this}rangeAdjacent(n,a){return this.url.searchParams.append(n,`adj.${a}`),this}overlaps(n,a){return typeof a=="string"?this.url.searchParams.append(n,`ov.${a}`):this.url.searchParams.append(n,`ov.{${a.join(",")}}`),this}textSearch(n,a,{config:l,type:h}={}){let i="";h==="plain"?i="pl":h==="phrase"?i="ph":h==="websearch"&&(i="w");let c=l===void 0?"":`(${l})`;return this.url.searchParams.append(n,`${i}fts${c}.${a}`),this}match(n){return Object.entries(n).forEach(([a,l])=>{this.url.searchParams.append(a,`eq.${l}`)}),this}not(n,a,l){return this.url.searchParams.append(n,`not.${a}.${l}`),this}or(n,{foreignTable:a,referencedTable:l=a}={}){let h=l?`${l}.or`:"or";return this.url.searchParams.append(h,`(${n})`),this}filter(n,a,l){return this.url.searchParams.append(n,`${a}.${l}`),this}};t.default=o}),Se=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(D()),s=class{constructor(o,{headers:n={},schema:a,fetch:l}){this.url=o,this.headers=new Headers(n),this.schema=a,this.fetch=l}select(o,n){let{head:a=!1,count:l}=n??{},h=a?"HEAD":"GET",i=!1,c=(o??"*").split("").map(u=>/\s/.test(u)&&!i?"":(u==='"'&&(i=!i),u)).join("");return this.url.searchParams.set("select",c),l&&this.headers.append("Prefer",`count=${l}`),new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(o,{count:n,defaultToNull:a=!0}={}){var l;let h="POST";if(n&&this.headers.append("Prefer",`count=${n}`),a||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let i=o.reduce((c,u)=>c.concat(Object.keys(u)),[]);if(i.length>0){let c=[...new Set(i)].map(u=>`"${u}"`);this.url.searchParams.set("columns",c.join(","))}}return new r.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(l=this.fetch)!==null&&l!==void 0?l:fetch})}upsert(o,{onConflict:n,ignoreDuplicates:a=!1,count:l,defaultToNull:h=!0}={}){var i;let c="POST";if(this.headers.append("Prefer",`resolution=${a?"ignore":"merge"}-duplicates`),n!==void 0&&this.url.searchParams.set("on_conflict",n),l&&this.headers.append("Prefer",`count=${l}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(o)){let u=o.reduce((f,d)=>f.concat(Object.keys(d)),[]);if(u.length>0){let f=[...new Set(u)].map(d=>`"${d}"`);this.url.searchParams.set("columns",f.join(","))}}return new r.default({method:c,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}update(o,{count:n}={}){var a;let l="PATCH";return n&&this.headers.append("Prefer",`count=${n}`),new r.default({method:l,url:this.url,headers:this.headers,schema:this.schema,body:o,fetch:(a=this.fetch)!==null&&a!==void 0?a:fetch})}delete({count:o}={}){var n;let a="DELETE";return o&&this.headers.append("Prefer",`count=${o}`),new r.default({method:a,url:this.url,headers:this.headers,schema:this.schema,fetch:(n=this.fetch)!==null&&n!==void 0?n:fetch})}};t.default=s}),We=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0});var e=($(),S(P)),r=e.__importDefault(Se()),s=e.__importDefault(D()),o=class $e{constructor(a,{headers:l={},schema:h,fetch:i}={}){this.url=a,this.headers=new Headers(l),this.schemaName=h,this.fetch=i}from(a){let l=new URL(`${this.url}/${a}`);return new r.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(a){return new $e(this.url,{headers:this.headers,schema:a,fetch:this.fetch})}rpc(a,l={},{head:h=!1,get:i=!1,count:c}={}){var u;let f,d=new URL(`${this.url}/rpc/${a}`),p;h||i?(f=h?"HEAD":"GET",Object.entries(l).filter(([y,g])=>g!==void 0).map(([y,g])=>[y,Array.isArray(g)?`{${g.join(",")}}`:`${g}`]).forEach(([y,g])=>{d.searchParams.append(y,g)})):(f="POST",p=l);let m=new Headers(this.headers);return c&&m.set("Prefer",`count=${c}`),new s.default({method:f,url:d,headers:m,schema:this.schemaName,body:p,fetch:(u=this.fetch)!==null&&u!==void 0?u:fetch})}};t.default=o}),Ve=_(t=>{"use strict";v(),Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;var e=($(),S(P)),r=e.__importDefault(We());t.PostgrestClient=r.default;var s=e.__importDefault(Se());t.PostgrestQueryBuilder=s.default;var o=e.__importDefault(D());t.PostgrestFilterBuilder=o.default;var n=e.__importDefault(Oe());t.PostgrestTransformBuilder=n.default;var a=e.__importDefault(Pe());t.PostgrestBuilder=a.default;var l=e.__importDefault(_e());t.PostgrestError=l.default,t.default={PostgrestClient:r.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:o.default,PostgrestTransformBuilder:n.default,PostgrestBuilder:a.default,PostgrestError:l.default}});v();v();var Te=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()}};v();v();var Ke="nvwa_current_jwt";v();v();var w=class xe{constructor(e){if(this.headerMap=new Map,e){if(e instanceof xe)e.forEach((r,s)=>this.set(s,r));else if(Array.isArray(e))for(let[r,s]of e)this.set(r,String(s));else if(typeof e=="object")for(let r of Object.keys(e))this.set(r,String(e[r]))}}append(e,r){let s=e.toLowerCase(),o=this.headerMap.get(s);this.headerMap.set(s,o?`${o}, ${r}`:r)}set(e,r){this.headerMap.set(e.toLowerCase(),String(r))}get(e){return this.headerMap.get(e.toLowerCase())??null}has(e){return this.headerMap.has(e.toLowerCase())}delete(e){this.headerMap.delete(e.toLowerCase())}forEach(e){for(let[r,s]of this.headerMap.entries())e(s,r,this)}entries(){return this.headerMap.entries()}keys(){return this.headerMap.keys()}values(){return this.headerMap.values()}[Symbol.iterator](){return this.entries()}},je=class Le{constructor(e){if(this.params=new Map,e){if(typeof e=="string")this.parseString(e);else if(e instanceof Le)this.params=new Map(e.params);else if(Array.isArray(e))for(let[r,s]of e)this.append(r,s);else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))this.set(r,s)}}parseString(e){e.startsWith("?")&&(e=e.slice(1));let r=e.split("&");for(let s of r)if(s){let[o,n]=s.split("=");o&&this.append(decodeURIComponent(o),n?decodeURIComponent(n):"")}}append(e,r){let s=this.params.get(e)||[];s.push(r),this.params.set(e,s)}delete(e){this.params.delete(e)}get(e){let r=this.params.get(e);return r?r[0]:null}getAll(e){return this.params.get(e)||[]}has(e){return this.params.has(e)}set(e,r){this.params.set(e,[r])}sort(){let e=Array.from(this.params.entries()).sort(([r],[s])=>r.localeCompare(s));this.params=new Map(e)}toString(){let e=[];for(let[r,s]of this.params.entries())for(let o of s)e.push(`${encodeURIComponent(r)}=${encodeURIComponent(o)}`);return e.join("&")}forEach(e){for(let[r,s]of this.params.entries())for(let o of s)e(o,r,this)}keys(){return this.params.keys()}values(){let e=[];for(let r of this.params.values())e.push(...r);return e[Symbol.iterator]()}entries(){let e=[];for(let[r,s]of this.params.entries())for(let o of s)e.push([r,o]);return e[Symbol.iterator]()}[Symbol.iterator](){return this.entries()}get size(){return this.params.size}},Je=class U{constructor(e,r){let s;if(e instanceof U)s=e.href;else if(r){let n=r instanceof U?r.href:r;s=this.resolve(n,e)}else s=e;let o=this.parseUrl(s);this.href=s,this.origin=`${o.protocol}//${o.host}`,this.protocol=o.protocol,this.username=o.username,this.password=o.password,this.host=o.host,this.hostname=o.hostname,this.port=o.port,this.pathname=o.pathname,this.search=o.search,this.searchParams=new je(o.search),this.hash=o.hash}resolve(e,r){if(r.startsWith("http://")||r.startsWith("https://"))return r;if(r.startsWith("//"))return`${this.parseUrl(e).protocol}${r}`;if(r.startsWith("/")){let n=this.parseUrl(e);return`${n.protocol}//${n.host}${r}`}let s=this.parseUrl(e),o=s.pathname.endsWith("/")?s.pathname:s.pathname+"/";return`${s.protocol}//${s.host}${o}${r}`}parseUrl(e){let r=e.match(/^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!r)throw new TypeError("Invalid URL");let s=r[2]||"",o=r[4]||"",n=r[5]||"/",a=r[7]?`?${r[7]}`:"",l=r[9]?`#${r[9]}`:"";if(!s&&!o&&!n.startsWith("/")&&!n.includes("/")&&!n.includes("."))throw new TypeError("Invalid URL");let h=o.match(/^([^@]*)@(.+)$/),i="",c="",u=o;if(h){let m=h[1];u=h[2];let y=m.match(/^([^:]*):?(.*)$/);y&&(i=y[1]||"",c=y[2]||"")}let f=u.match(/^([^:]+):?(\d*)$/),d=f?f[1]:u,p=f&&f[2]?f[2]:"";return{protocol:s?`${s}:`:"",username:i,password:c,host:u,hostname:d,port:p,pathname:n,search:a,hash:l}}toString(){let e=this.searchParams.toString(),r=e?`?${e}`:"";return`${this.protocol}//${this.host}${this.pathname}${r}${this.hash}`}toJSON(){return this.toString()}};v();var Qe=class Ae{constructor(e,r){if(typeof e=="string")this.url=e;else if(e?.url)this.url=String(e.url);else if(typeof e?.toString=="function")this.url=String(e.toString());else throw new Error("Invalid input for Request");this.method=(r?.method||"GET").toUpperCase(),this.headers=r?.headers instanceof w?r.headers:new w(r?.headers),this.body=r?.body,this.timeout=r?.timeout,this.signal=r?.signal||void 0}clone(){return new Ae(this.url,{method:this.method,headers:this.headers,body:this.body,timeout:this.timeout})}toString(){return this.url}};v();var F=class{constructor(t,e){this.bodyData=t,this.status=e?.status??200,this.statusText=e?.statusText??"",this.headers=Ye(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 Ye(t){return t?new w(t):new w}v();var Ie=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]"}},Xe=class{constructor(){this._signal=new Ie}get signal(){return this._signal}abort(){this._signal._trigger()}toString(){return"[object AbortController]"}};v();function Ze(t){t.URL=Je,t.URLSearchParams=je,t.Headers=w,t.Request=Qe,t.Response=F,t.AbortController=Xe,t.AbortSignal=Ie}var Ce=class{constructor(t,e,r){console.log("NvwaHttpClient 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(Ke),s=new w(e?.headers);r&&s.set("Authorization",`Bearer ${r}`);let o=e?.method||"GET";if((o==="POST"||o==="PUT"||o==="PATCH")&&e?.body){let a=s.get("Content-Type");(!a||a.includes("text/plain"))&&s.set("Content-Type","application/json")}let n=await this.customFetch(t,{...e,headers:s});if(n.status===401)throw this.handleUnauthorized(),new Error("\u672A\u767B\u5F55");return n}};v();var et="/storage",tt=et+"/generateUploadUrl",Ne=class{constructor(t,e){this.baseUrl=t,this.http=e}async uploadFile(t){let e=await this.http.fetch(this.baseUrl+tt,{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:o}=await s.json();return{url:o.split("?")[0]}}};v();v();v();var q=Ge(Ve(),1),{PostgrestClient:rt,PostgrestQueryBuilder:at,PostgrestFilterBuilder:it,PostgrestTransformBuilder:lt,PostgrestBuilder:ct,PostgrestError:ht}=q.default||q,st="/entities",He=(t,e)=>new rt(t+st,{fetch:e.fetchWithAuth.bind(e)});v();var Re=class{constructor(t,e){this.baseUrl=t,this.http=e}async execute(t,e){let r=`${this.baseUrl}/skill/${t}/execute`,s=await(await this.http.fetchWithAuth(r,{method:"POST",body:e?JSON.stringify(e):void 0,timeout:6e5})).json();if(s.status!==200)throw new Error(s.message);return s.data}};v();var Me=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;
|
|
@@ -30,4 +30,4 @@ var ke=Object.create,N=Object.defineProperty,De=Object.getOwnPropertyDescriptor,
|
|
|
30
30
|
max-width: 400px;
|
|
31
31
|
word-break: break-all;
|
|
32
32
|
}
|
|
33
|
-
`,document.head.appendChild(t)}createTooltip(){return this.tooltip?this.tooltip:(this.tooltip=document.createElement("div"),this.tooltip.id="__nvwa-inspector-tooltip",document.body.appendChild(this.tooltip),this.tooltip)}createOverlay(t){let e=document.createElement("div");return e.className=`__nvwa-inspector-overlay __nvwa-inspector-overlay-${t}`,document.body.appendChild(e),e}updateOverlayPosition(t,e){if(!e.isConnected)return;let r=e.getBoundingClientRect(),s=window.scrollX||window.pageXOffset,o=window.scrollY||window.pageYOffset;r.width>0&&r.height>0?(t.style.left=`${r.left+s}px`,t.style.top=`${r.top+o}px`,t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.display="block"):t.style.display="none"}removeOverlay(t){t&&t.parentNode&&t.parentNode.removeChild(t)}highlightElement(t,e){if(!t.isConnected)return;if(this.hoverElement===t&&this.hoverOverlay){this.updateOverlayPosition(this.hoverOverlay,t);let a=this.createTooltip();e?a.textContent=e:a.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,a.style.display="block";let l=t.getBoundingClientRect();a.style.left=`${l.left+window.scrollX}px`,a.style.top=`${l.top+window.scrollY-a.offsetHeight-8}px`,l.top<a.offsetHeight+8&&(a.style.top=`${l.bottom+window.scrollY+8}px`);return}this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null);let r=this.createOverlay("hover");this.updateOverlayPosition(r,t),this.hoverOverlay=r,this.hoverElement=t;let s=()=>{this.hoverOverlay&&this.hoverElement&&this.hoverElement.isConnected&&this.updateOverlayPosition(this.hoverOverlay,this.hoverElement)};this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler)),this.hoverUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s);let o=this.createTooltip();e?o.textContent=e:o.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,o.style.display="block";let n=t.getBoundingClientRect();o.style.left=`${n.left+window.scrollX}px`,o.style.top=`${n.top+window.scrollY-o.offsetHeight-8}px`,n.top<o.offsetHeight+8&&(o.style.top=`${n.bottom+window.scrollY+8}px`)}selectElement(t,e){if(!t.isConnected)return;if(this.selectedElement===t&&this.selectedOverlay){this.updateOverlayPosition(this.selectedOverlay,t);return}this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null);let r=this.createOverlay("selected");this.updateOverlayPosition(r,t),this.selectedOverlay=r,this.selectedElement=t;let s=()=>{this.selectedOverlay&&this.selectedElement&&this.selectedElement.isConnected&&this.updateOverlayPosition(this.selectedOverlay,this.selectedElement)};this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler)),this.selectedUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s)}removeHighlight(){this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null),this.hoverElement&&(this.hoverElement=null),this.tooltip&&(this.tooltip.style.display="none"),this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler),this.hoverUpdateHandler=null)}clearSelection(){this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null),this.selectedElement&&(this.selectedElement=null),this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler),this.selectedUpdateHandler=null)}cleanup(){this.removeHighlight(),this.clearSelection(),this.tooltip&&this.tooltip.parentNode&&(this.tooltip.parentNode.removeChild(this.tooltip),this.tooltip=null);let t=document.getElementById("__nvwa-inspector-overlay-style");t&&t.parentNode&&t.parentNode.removeChild(t)}};function Ue(t="root"){if(typeof document>"u")return null;let e=document.getElementById(t)||document.body;if(!e)return null;let r=e.querySelector("[data-source-location]");if(r){let s=r.getAttribute("data-source-location");if(s)return s}if(e.firstElementChild){let s=e.firstElementChild.getAttribute("data-source-location");if(s)return s}return null}v();var ut=typeof fetch<"u"?fetch:(()=>{throw new Error("payment client requires fetch")})();var H=class{constructor(){this.prefix="nvwa_"}getKey(e){return`${this.prefix}${e}`}async get(e){try{let r=this.getKey(e),s=uni.getStorageSync(r);return s?s.expires&&Date.now()>s.expires?(await this.remove(e),null):s.value:null}catch(r){return console.error("UniAppStorageService get error:",r),null}}async set(e,r,s){try{let o=this.getKey(e),n={value:r,expires:s?Date.now()+s*1e3:null,timestamp:Date.now()};uni.setStorageSync(o,n)}catch(o){throw console.error("UniAppStorageService set error:",o),o}}async remove(e){try{let r=this.getKey(e);uni.removeStorageSync(r)}catch(r){throw console.error("UniAppStorageService remove error:",r),r}}async clear(){try{uni.clearStorageSync()}catch(e){throw console.error("UniAppStorageService clear error:",e),e}}};var R=(t,e)=>{let r;if(typeof t=="string")r=t;else if(t&&typeof t.toString=="function")r=t.toString();else if(t?.url)r=t.url;else throw new Error("Invalid input for uniappFetch");let s=(e?.method||"GET").toUpperCase(),o={};if(e?.headers){let l=e.headers;if(typeof l?.forEach=="function")l.forEach((h,i)=>{o[i]=h});else if(Array.isArray(l))for(let[h,i]of l)o[h]=i;else Object.assign(o,l)}let n;if(e?.body!==void 0){let l=e.body;if(typeof l=="string")n=l;else if(l&&typeof l=="object"&&typeof l.forEach=="function"){let h={};l.forEach((i,c)=>{h[c]=i}),n=h}else n=l}let a=e?.timeout||3e4;return new Promise((l,h)=>{let i=e?.signal;if(i?.aborted){let d=new Error("The operation was aborted");d.name="AbortError",h(d);return}let c=!1,u=[],f=uni.request({url:r,method:s,data:n,header:o,timeout:a,success:d=>{if(c)return;c=!0;let p=d.statusCode,m="",y=new w,g=d.header||d.headers||{};Object.keys(g).forEach(b=>{let E=g[b];y.set(b,typeof E=="string"?E:String(E))}),l(new F(d.data,{status:p,statusText:m,headers:y}))},fail:d=>{if(c)return;c=!0;let p=d?.errMsg||d?.message||"Network Error",m=new Error(p);/(abort|aborted|canceled|cancelled)/i.test(String(p))&&(m.name="AbortError"),h(m)}});if(i&&typeof i.addEventListener=="function"){let d=()=>{if(c)return;try{f?.abort?.()}catch{}let p=new Error("The operation was aborted");p.name="AbortError",c=!0,h(p)};i.addEventListener("abort",d),u.push(()=>{try{i.removeEventListener?.("abort",d)}catch{}})}})};typeof globalThis.fetch!="function"&&(globalThis.fetch=R);function Ut(){if(typeof window>"u"||window===window.parent)return;let t=!1,e=new Me;function r(i){if(!i)return!1;let c=i.toLowerCase();return c.includes("/components/")||c.includes("\\components\\")}function s(i){let c=i,u=null;for(;c;){let f=c.getAttribute("data-source-location");if(f)if(r(f)){u||(u=f),c=c.parentElement;continue}else return f;c=c.parentElement}return u}let o=null;function n(i){t&&(o!==null&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{let c=i.target;if(!c||c===document.body||c===document.documentElement){e.removeHighlight();return}if(c.tagName.toLowerCase()==="img"){let p=s(c);e.highlightElement(c,p);let m={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:p,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(m,"*");return}let u=c,f=s(c);if(!f){let p=c.parentElement;for(;p&&p!==document.body&&p!==document.documentElement;){let m=s(p);if(m){u=p,f=m;break}p=p.parentElement}}e.highlightElement(u,f);let d={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:f,elementInfo:{tagName:u.tagName.toLowerCase(),className:u.className||"",id:u.id||""}};window.parent.postMessage(d,"*")}))}function a(){if(!t)return;e.removeHighlight();let i={type:"HOVER_INSPECTOR_ELEMENT_LEAVE"};window.parent.postMessage(i,"*")}function l(i){if(!t)return;i.preventDefault(),i.stopPropagation();let c=i.target;if(!c||c===document.body||c===document.documentElement)return;let u=s(c);e.selectElement(c,u);let f={type:"HOVER_INSPECTOR_ELEMENT_SELECT",sourceLocation:u,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(f,"*")}function h(i){i.data?.type==="HOVER_INSPECTOR_ENABLE"?(t=!0,document.addEventListener("mousemove",n),document.addEventListener("mouseleave",a),document.addEventListener("click",l,!0)):i.data?.type==="HOVER_INSPECTOR_DISABLE"&&(t=!1,document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",a),document.removeEventListener("click",l,!0),e.removeHighlight(),e.clearSelection())}return window.addEventListener("message",h),()=>{window.removeEventListener("message",h),document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",a),document.removeEventListener("click",l,!0),e.cleanup()}}function kt(t,e){if(!t||!t.contentWindow)throw new Error("Invalid iframe element");let r={type:"HOVER_INSPECTOR_ENABLE"};t.contentWindow.postMessage(r,e)}function Dt(t,e){if(!t||!t.contentWindow)return;let r={type:"HOVER_INSPECTOR_DISABLE"};t.contentWindow.postMessage(r,e)}function Ft(t,e,r=5e3){return new Promise((s,o)=>{if(!t||!t.contentWindow){o(new Error("Invalid iframe element"));return}let n=`source-location-${Date.now()}-${Math.random()}`,a=setTimeout(()=>{window.removeEventListener("message",l),o(new Error("Request timeout"))},r),l=i=>{i.origin===e&&i.data?.type==="GET_SOURCE_LOCATION_RESPONSE"&&i.data?.requestId===n&&(clearTimeout(a),window.removeEventListener("message",l),i.data.error?o(new Error(i.data.error)):s(i.data.sourceLocation||null))};window.addEventListener("message",l);let h={type:"GET_SOURCE_LOCATION_REQUEST",requestId:n};try{t.contentWindow.postMessage(h,e)}catch(i){clearTimeout(a),window.removeEventListener("message",l),o(i)}})}function Bt(){if(typeof window>"u"||window===window.parent)return;let t=e=>{if(e.data?.type==="GET_SOURCE_LOCATION_REQUEST")try{let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:nt(),requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}catch(r){let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:null,error:r instanceof Error?r.message:"Unknown error",requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}function nt(){return Ue("app")}var ot=new H,B=class{constructor(e,r){this.httpClient=new Ce(ot,R,r),this.fileStorage=new Ne(e,this.httpClient),this.entities=He(e,this.httpClient),this.functions=new Te(this.httpClient),this.skill=new Re(e,this.httpClient)}};export{B as default,Dt as disableIframeHoverInspector,kt as enableIframeHoverInspector,Ft as getIframeSourceLocation,ot as localStorage,Ze as polyfill,Ut as setupIframeHoverInspector,Bt as setupIframeSourceLocationListener,R as uniappFetch};
|
|
33
|
+
`,document.head.appendChild(t)}createTooltip(){return this.tooltip?this.tooltip:(this.tooltip=document.createElement("div"),this.tooltip.id="__nvwa-inspector-tooltip",document.body.appendChild(this.tooltip),this.tooltip)}createOverlay(t){let e=document.createElement("div");return e.className=`__nvwa-inspector-overlay __nvwa-inspector-overlay-${t}`,document.body.appendChild(e),e}updateOverlayPosition(t,e){if(!e.isConnected)return;let r=e.getBoundingClientRect(),s=window.scrollX||window.pageXOffset,o=window.scrollY||window.pageYOffset;r.width>0&&r.height>0?(t.style.left=`${r.left+s}px`,t.style.top=`${r.top+o}px`,t.style.width=`${r.width}px`,t.style.height=`${r.height}px`,t.style.display="block"):t.style.display="none"}removeOverlay(t){t&&t.parentNode&&t.parentNode.removeChild(t)}highlightElement(t,e){if(!t.isConnected)return;if(this.hoverElement===t&&this.hoverOverlay){this.updateOverlayPosition(this.hoverOverlay,t);let a=this.createTooltip();e?a.textContent=e:a.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,a.style.display="block";let l=t.getBoundingClientRect();a.style.left=`${l.left+window.scrollX}px`,a.style.top=`${l.top+window.scrollY-a.offsetHeight-8}px`,l.top<a.offsetHeight+8&&(a.style.top=`${l.bottom+window.scrollY+8}px`);return}this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null);let r=this.createOverlay("hover");this.updateOverlayPosition(r,t),this.hoverOverlay=r,this.hoverElement=t;let s=()=>{this.hoverOverlay&&this.hoverElement&&this.hoverElement.isConnected&&this.updateOverlayPosition(this.hoverOverlay,this.hoverElement)};this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler)),this.hoverUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s);let o=this.createTooltip();e?o.textContent=e:o.textContent=`<${t.tagName.toLowerCase()}> (\u65E0 source location)`,o.style.display="block";let n=t.getBoundingClientRect();o.style.left=`${n.left+window.scrollX}px`,o.style.top=`${n.top+window.scrollY-o.offsetHeight-8}px`,n.top<o.offsetHeight+8&&(o.style.top=`${n.bottom+window.scrollY+8}px`)}selectElement(t,e){if(!t.isConnected)return;if(this.selectedElement===t&&this.selectedOverlay){this.updateOverlayPosition(this.selectedOverlay,t);return}this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null);let r=this.createOverlay("selected");this.updateOverlayPosition(r,t),this.selectedOverlay=r,this.selectedElement=t;let s=()=>{this.selectedOverlay&&this.selectedElement&&this.selectedElement.isConnected&&this.updateOverlayPosition(this.selectedOverlay,this.selectedElement)};this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler)),this.selectedUpdateHandler=s,window.addEventListener("scroll",s,!0),window.addEventListener("resize",s)}removeHighlight(){this.hoverOverlay&&(this.removeOverlay(this.hoverOverlay),this.hoverOverlay=null),this.hoverElement&&(this.hoverElement=null),this.tooltip&&(this.tooltip.style.display="none"),this.hoverUpdateHandler&&(window.removeEventListener("scroll",this.hoverUpdateHandler,!0),window.removeEventListener("resize",this.hoverUpdateHandler),this.hoverUpdateHandler=null)}clearSelection(){this.selectedOverlay&&(this.removeOverlay(this.selectedOverlay),this.selectedOverlay=null),this.selectedElement&&(this.selectedElement=null),this.selectedUpdateHandler&&(window.removeEventListener("scroll",this.selectedUpdateHandler,!0),window.removeEventListener("resize",this.selectedUpdateHandler),this.selectedUpdateHandler=null)}cleanup(){this.removeHighlight(),this.clearSelection(),this.tooltip&&this.tooltip.parentNode&&(this.tooltip.parentNode.removeChild(this.tooltip),this.tooltip=null);let t=document.getElementById("__nvwa-inspector-overlay-style");t&&t.parentNode&&t.parentNode.removeChild(t)}};function Ue(t="root"){if(typeof document>"u")return null;let e=document.getElementById(t)||document.body;if(!e)return null;let r=e.querySelector("[data-source-location]");if(r){let s=r.getAttribute("data-source-location");if(s)return s}if(e.firstElementChild){let s=e.firstElementChild.getAttribute("data-source-location");if(s)return s}return null}v();var ut=typeof fetch<"u"?fetch:(()=>{throw new Error("payment client requires fetch")})();var H=class{constructor(){this.prefix="nvwa_"}getKey(e){return`${this.prefix}${e}`}async get(e){try{let r=this.getKey(e),s=uni.getStorageSync(r);return s?s.expires&&Date.now()>s.expires?(await this.remove(e),null):s.value:null}catch(r){return console.error("UniAppStorageService get error:",r),null}}async set(e,r,s){try{let o=this.getKey(e),n={value:r,expires:s?Date.now()+s*1e3:null,timestamp:Date.now()};uni.setStorageSync(o,n)}catch(o){throw console.error("UniAppStorageService set error:",o),o}}async remove(e){try{let r=this.getKey(e);uni.removeStorageSync(r)}catch(r){throw console.error("UniAppStorageService remove error:",r),r}}async clear(){try{uni.clearStorageSync()}catch(e){throw console.error("UniAppStorageService clear error:",e),e}}};var R=(t,e)=>{let r;if(typeof t=="string")r=t;else if(t&&typeof t.toString=="function")r=t.toString();else if(t?.url)r=t.url;else throw new Error("Invalid input for uniappFetch");let s=(e?.method||"GET").toUpperCase(),o={};if(e?.headers){let l=e.headers;if(typeof l?.forEach=="function")l.forEach((h,i)=>{o[i]=h});else if(Array.isArray(l))for(let[h,i]of l)o[h]=i;else Object.assign(o,l)}let n;if(e?.body!==void 0){let l=e.body;if(typeof l=="string")n=l;else if(l&&typeof l=="object"&&typeof l.forEach=="function"){let h={};l.forEach((i,c)=>{h[c]=i}),n=h}else n=l}let a=e?.timeout||3e4;return new Promise((l,h)=>{let i=e?.signal;if(i?.aborted){let d=new Error("The operation was aborted");d.name="AbortError",h(d);return}let c=!1,u=[],f=uni.request({url:r,method:s,data:n,header:o,timeout:a,success:d=>{if(c)return;c=!0;let p=d.statusCode,m="",y=new w,g=d.header||d.headers||{};Object.keys(g).forEach(b=>{let E=g[b];y.set(b,typeof E=="string"?E:String(E))}),l(new F(d.data,{status:p,statusText:m,headers:y}))},fail:d=>{if(c)return;c=!0;let p=d?.errMsg||d?.message||"Network Error",m=new Error(p);/(abort|aborted|canceled|cancelled)/i.test(String(p))&&(m.name="AbortError"),h(m)}});if(i&&typeof i.addEventListener=="function"){let d=()=>{if(c)return;try{f?.abort?.()}catch{}let p=new Error("The operation was aborted");p.name="AbortError",c=!0,h(p)};i.addEventListener("abort",d),u.push(()=>{try{i.removeEventListener?.("abort",d)}catch{}})}})};typeof globalThis.fetch!="function"&&(globalThis.fetch=R);function Ut(){if(typeof window>"u"||window===window.parent)return;let t=!1,e=new Me;function r(i){if(!i)return!1;let c=i.toLowerCase();return c.includes("/components/")||c.includes("\\components\\")}function s(i){let c=i,u=null;for(;c;){let f=c.getAttribute("data-source-location");if(f)if(r(f)){u||(u=f),c=c.parentElement;continue}else return f;c=c.parentElement}return u}let o=null;function n(i){t&&(o!==null&&cancelAnimationFrame(o),o=requestAnimationFrame(()=>{let c=i.target;if(!c||c===document.body||c===document.documentElement){e.removeHighlight();return}if(c.tagName.toLowerCase()==="img"){let p=s(c);e.highlightElement(c,p);let m={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:p,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(m,"*");return}let u=c,f=s(c);if(!f){let p=c.parentElement;for(;p&&p!==document.body&&p!==document.documentElement;){let m=s(p);if(m){u=p,f=m;break}p=p.parentElement}}e.highlightElement(u,f);let d={type:"HOVER_INSPECTOR_ELEMENT_HOVER",sourceLocation:f,elementInfo:{tagName:u.tagName.toLowerCase(),className:u.className||"",id:u.id||""}};window.parent.postMessage(d,"*")}))}function a(){if(!t)return;e.removeHighlight();let i={type:"HOVER_INSPECTOR_ELEMENT_LEAVE"};window.parent.postMessage(i,"*")}function l(i){if(!t)return;i.preventDefault(),i.stopPropagation();let c=i.target;if(!c||c===document.body||c===document.documentElement)return;let u=s(c);e.selectElement(c,u);let f={type:"HOVER_INSPECTOR_ELEMENT_SELECT",sourceLocation:u,elementInfo:{tagName:c.tagName.toLowerCase(),className:c.className||"",id:c.id||""}};window.parent.postMessage(f,"*")}function h(i){i.data?.type==="HOVER_INSPECTOR_ENABLE"?(t=!0,document.addEventListener("mousemove",n),document.addEventListener("mouseleave",a),document.addEventListener("click",l,!0)):i.data?.type==="HOVER_INSPECTOR_DISABLE"&&(t=!1,document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",a),document.removeEventListener("click",l,!0),e.removeHighlight(),e.clearSelection())}return window.addEventListener("message",h),()=>{window.removeEventListener("message",h),document.removeEventListener("mousemove",n),document.removeEventListener("mouseleave",a),document.removeEventListener("click",l,!0),e.cleanup()}}function kt(t,e){if(!t||!t.contentWindow)throw new Error("Invalid iframe element");let r={type:"HOVER_INSPECTOR_ENABLE"};t.contentWindow.postMessage(r,e)}function Dt(t,e){if(!t||!t.contentWindow)return;let r={type:"HOVER_INSPECTOR_DISABLE"};t.contentWindow.postMessage(r,e)}function Ft(t,e,r=5e3){return new Promise((s,o)=>{if(!t||!t.contentWindow){o(new Error("Invalid iframe element"));return}let n=`source-location-${Date.now()}-${Math.random()}`,a=setTimeout(()=>{window.removeEventListener("message",l),o(new Error("Request timeout"))},r),l=i=>{i.origin===e&&i.data?.type==="GET_SOURCE_LOCATION_RESPONSE"&&i.data?.requestId===n&&(clearTimeout(a),window.removeEventListener("message",l),i.data.error?o(new Error(i.data.error)):s(i.data.sourceLocation||null))};window.addEventListener("message",l);let h={type:"GET_SOURCE_LOCATION_REQUEST",requestId:n};try{t.contentWindow.postMessage(h,e)}catch(i){clearTimeout(a),window.removeEventListener("message",l),o(i)}})}function Bt(){if(typeof window>"u"||window===window.parent)return;let t=e=>{if(e.data?.type==="GET_SOURCE_LOCATION_REQUEST")try{let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:nt(),requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}catch(r){let s={type:"GET_SOURCE_LOCATION_RESPONSE",sourceLocation:null,error:r instanceof Error?r.message:"Unknown error",requestId:e.data.requestId};window.parent.postMessage(s,e.origin)}};return window.addEventListener("message",t),()=>{window.removeEventListener("message",t)}}function nt(){return Ue("app")}var ot=new H,B=class{constructor(e,r){this.httpClient=new Ce(ot,R,r),this.fileStorage=new Ne(e,this.httpClient),this.entities=He(e,this.httpClient),this.functions=new Te(this.httpClient,e),this.skill=new Re(e,this.httpClient)}};export{B as default,Dt as disableIframeHoverInspector,kt as enableIframeHoverInspector,Ft as getIframeSourceLocation,ot as localStorage,Ze as polyfill,Ut as setupIframeHoverInspector,Bt as setupIframeSourceLocationListener,R as uniappFetch};
|