UNPKG

friday-widgets

Version:

Professional embeddable accounting widgets for vertical SaaS platforms. Layer Financial-inspired design with comprehensive financial reporting capabilities.

626 lines (545 loc) 46.8 kB
var FridayPnLTableWidget=function(e){"use strict";function t(e,t,r,s){var i,o=arguments.length,a=o<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,s);else for(var n=e.length-1;n>=0;n--)(i=e[n])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}"function"==typeof SuppressedError&&SuppressedError; /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const r=globalThis,s=r.ShadowRoot&&(void 0===r.ShadyCSS||r.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),o=new WeakMap;let a=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(s&&void 0===e){const r=void 0!==t&&1===t.length;r&&(e=o.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&o.set(t,e))}return e}toString(){return this.cssText}};const n=(e,...t)=>{const r=1===e.length?e[0]:t.reduce((t,r,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[s+1],e[0]);return new a(r,e,i)},d=s?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return(e=>new a("string"==typeof e?e:e+"",void 0,i))(t)})(e):e,{is:l,defineProperty:c,getOwnPropertyDescriptor:h,getOwnPropertyNames:p,getOwnPropertySymbols:u,getPrototypeOf:m}=Object,y=globalThis,g=y.trustedTypes,v=g?g.emptyScript:"",b=y.reactiveElementPolyfillSupport,_=(e,t)=>e,f={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},x=(e,t)=>!l(e,t),$={attribute:!0,type:String,converter:f,reflect:!1,useDefault:!1,hasChanged:x}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */Symbol.metadata??=Symbol("metadata"),y.litPropertyMetadata??=new WeakMap;let w=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=$){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),s=this.getPropertyDescriptor(e,r,t);void 0!==s&&c(this.prototype,e,s)}}static getPropertyDescriptor(e,t,r){const{get:s,set:i}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:s,set(t){const o=s?.call(this);i?.call(this,t),this.requestUpdate(e,o,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??$}static _$Ei(){if(this.hasOwnProperty(_("elementProperties")))return;const e=m(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(_("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_("properties"))){const e=this.properties,t=[...p(e),...u(e)];for(const r of t)this.createProperty(r,e[r])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,r]of t)this.elementProperties.set(e,r)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const e of r)t.unshift(d(e))}else void 0!==e&&t.push(d(e));return t}static _$Eu(e,t){const r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(s)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const s of t){const t=document.createElement("style"),i=r.litNonce;void 0!==i&&t.setAttribute("nonce",i),t.textContent=s.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){const r=this.constructor.elementProperties.get(e),s=this.constructor._$Eu(e,r);if(void 0!==s&&!0===r.reflect){const i=(void 0!==r.converter?.toAttribute?r.converter:f).toAttribute(t,r.type);this._$Em=e,null==i?this.removeAttribute(s):this.setAttribute(s,i),this._$Em=null}}_$AK(e,t){const r=this.constructor,s=r._$Eh.get(e);if(void 0!==s&&this._$Em!==s){const e=r.getPropertyOptions(s),i="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:f;this._$Em=s;const o=i.fromAttribute(t,e.type);this[s]=o??this._$Ej?.get(s)??o,this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){const s=this.constructor,i=this[e];if(r??=s.getPropertyOptions(e),!((r.hasChanged??x)(i,t)||r.useDefault&&r.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(s._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:s,wrapped:i},o){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,o??t??this[e]),!0!==i||void 0!==o)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===s&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,r]of e){const{wrapped:e}=r,s=this[t];!0!==e||this._$AL.has(t)||void 0===s||this.C(t,void 0,r,s)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};w.elementStyles=[],w.shadowRootOptions={mode:"open"},w[_("elementProperties")]=new Map,w[_("finalized")]=new Map,b?.({ReactiveElement:w}),(y.reactiveElementVersions??=[]).push("2.1.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const A=globalThis,S=A.trustedTypes,E=S?S.createPolicy("lit-html",{createHTML:e=>e}):void 0,P="$lit$",F=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+F,C=`<${k}>`,T=document,O=()=>T.createComment(""),U=e=>null===e||"object"!=typeof e&&"function"!=typeof e,R=Array.isArray,D="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,L=/-->/g,q=/>/g,N=RegExp(`>|${D}(?:([^\\s"'>=/]+)(${D}*=${D}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),M=/'/g,H=/"/g,z=/^(?:script|style|textarea|title)$/i,B=(e=>(t,...r)=>({_$litType$:e,strings:t,values:r}))(1),j=Symbol.for("lit-noChange"),W=Symbol.for("lit-nothing"),J=new WeakMap,K=T.createTreeWalker(T,129);function G(e,t){if(!R(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const V=(e,t)=>{const r=e.length-1,s=[];let i,o=2===t?"<svg>":3===t?"<math>":"",a=I;for(let t=0;t<r;t++){const r=e[t];let n,d,l=-1,c=0;for(;c<r.length&&(a.lastIndex=c,d=a.exec(r),null!==d);)c=a.lastIndex,a===I?"!--"===d[1]?a=L:void 0!==d[1]?a=q:void 0!==d[2]?(z.test(d[2])&&(i=RegExp("</"+d[2],"g")),a=N):void 0!==d[3]&&(a=N):a===N?">"===d[0]?(a=i??I,l=-1):void 0===d[1]?l=-2:(l=a.lastIndex-d[2].length,n=d[1],a=void 0===d[3]?N:'"'===d[3]?H:M):a===H||a===M?a=N:a===L||a===q?a=I:(a=N,i=void 0);const h=a===N&&e[t+1].startsWith("/>")?" ":"";o+=a===I?r+C:l>=0?(s.push(n),r.slice(0,l)+P+r.slice(l)+F+h):r+F+(-2===l?t:h)}return[G(e,o+(e[r]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),s]};class Z{constructor({strings:e,_$litType$:t},r){let s;this.parts=[];let i=0,o=0;const a=e.length-1,n=this.parts,[d,l]=V(e,t);if(this.el=Z.createElement(d,r),K.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(s=K.nextNode())&&n.length<a;){if(1===s.nodeType){if(s.hasAttributes())for(const e of s.getAttributeNames())if(e.endsWith(P)){const t=l[o++],r=s.getAttribute(e).split(F),a=/([.?@])?(.*)/.exec(t);n.push({type:1,index:i,name:a[2],strings:r,ctor:"."===a[1]?te:"?"===a[1]?re:"@"===a[1]?se:ee}),s.removeAttribute(e)}else e.startsWith(F)&&(n.push({type:6,index:i}),s.removeAttribute(e));if(z.test(s.tagName)){const e=s.textContent.split(F),t=e.length-1;if(t>0){s.textContent=S?S.emptyScript:"";for(let r=0;r<t;r++)s.append(e[r],O()),K.nextNode(),n.push({type:2,index:++i});s.append(e[t],O())}}}else if(8===s.nodeType)if(s.data===k)n.push({type:2,index:i});else{let e=-1;for(;-1!==(e=s.data.indexOf(F,e+1));)n.push({type:7,index:i}),e+=F.length-1}i++}}static createElement(e,t){const r=T.createElement("template");return r.innerHTML=e,r}}function X(e,t,r=e,s){if(t===j)return t;let i=void 0!==s?r._$Co?.[s]:r._$Cl;const o=U(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),void 0===o?i=void 0:(i=new o(e),i._$AT(e,r,s)),void 0!==s?(r._$Co??=[])[s]=i:r._$Cl=i),void 0!==i&&(t=X(e,i._$AS(e,t.values),i,s)),t}class Q{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:r}=this._$AD,s=(e?.creationScope??T).importNode(t,!0);K.currentNode=s;let i=K.nextNode(),o=0,a=0,n=r[0];for(;void 0!==n;){if(o===n.index){let t;2===n.type?t=new Y(i,i.nextSibling,this,e):1===n.type?t=new n.ctor(i,n.name,n.strings,this,e):6===n.type&&(t=new ie(i,this,e)),this._$AV.push(t),n=r[++a]}o!==n?.index&&(i=K.nextNode(),o++)}return K.currentNode=T,s}p(e){let t=0;for(const r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class Y{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,r,s){this.type=2,this._$AH=W,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=X(this,e,t),U(e)?e===W||null==e||""===e?(this._$AH!==W&&this._$AR(),this._$AH=W):e!==this._$AH&&e!==j&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>R(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==W&&U(this._$AH)?this._$AA.nextSibling.data=e:this.T(T.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:r}=e,s="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=Z.createElement(G(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===s)this._$AH.p(t);else{const e=new Q(s,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=J.get(e.strings);return void 0===t&&J.set(e.strings,t=new Z(e)),t}k(e){R(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let r,s=0;for(const i of e)s===t.length?t.push(r=new Y(this.O(O()),this.O(O()),this,this.options)):r=t[s],r._$AI(i),s++;s<t.length&&(this._$AR(r&&r._$AB.nextSibling,s),t.length=s)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class ee{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,s,i){this.type=1,this._$AH=W,this._$AN=void 0,this.element=e,this.name=t,this._$AM=s,this.options=i,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=W}_$AI(e,t=this,r,s){const i=this.strings;let o=!1;if(void 0===i)e=X(this,e,t,0),o=!U(e)||e!==this._$AH&&e!==j,o&&(this._$AH=e);else{const s=e;let a,n;for(e=i[0],a=0;a<i.length-1;a++)n=X(this,s[r+a],t,a),n===j&&(n=this._$AH[a]),o||=!U(n)||n!==this._$AH[a],n===W?e=W:e!==W&&(e+=(n??"")+i[a+1]),this._$AH[a]=n}o&&!s&&this.j(e)}j(e){e===W?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class te extends ee{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===W?void 0:e}}class re extends ee{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==W)}}class se extends ee{constructor(e,t,r,s,i){super(e,t,r,s,i),this.type=5}_$AI(e,t=this){if((e=X(this,e,t,0)??W)===j)return;const r=this._$AH,s=e===W&&r!==W||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,i=e!==W&&(r===W||s);s&&this.element.removeEventListener(this.name,this,r),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ie{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){X(this,e)}}const oe=A.litHtmlPolyfillSupport;oe?.(Z,Y),(A.litHtmlVersions??=[]).push("3.3.1");const ae=globalThis; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */class ne extends w{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,r)=>{const s=r?.renderBefore??t;let i=s._$litPart$;if(void 0===i){const e=r?.renderBefore??null;s._$litPart$=i=new Y(t.insertBefore(O(),e),e,void 0,r??{})}return i._$AI(e),i})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return j}}ne._$litElement$=!0,ne.finalized=!0,ae.litElementHydrateSupport?.({LitElement:ne});const de=ae.litElementPolyfillSupport;de?.({LitElement:ne}),(ae.litElementVersions??=[]).push("4.2.1"); /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */ const le={attribute:!0,type:String,converter:f,reflect:!1,hasChanged:x},ce=(e=le,t,r)=>{const{kind:s,metadata:i}=r;let o=globalThis.litPropertyMetadata.get(i);if(void 0===o&&globalThis.litPropertyMetadata.set(i,o=new Map),"setter"===s&&((e=Object.create(e)).wrapped=!0),o.set(r.name,e),"accessor"===s){const{name:s}=r;return{set(r){const i=t.get.call(this);t.set.call(this,r),this.requestUpdate(s,i,e)},init(t){return void 0!==t&&this.C(s,void 0,e,t),t}}}if("setter"===s){const{name:s}=r;return function(r){const i=this[s];t.call(this,r),this.requestUpdate(s,i,e)}}throw Error("Unsupported decorator location: "+s)}; /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */function he(e){return(t,r)=>"object"==typeof r?ce(e,t,r):((e,t,r)=>{const s=t.hasOwnProperty(r);return t.constructor.createProperty(r,e),s?Object.getOwnPropertyDescriptor(t,r):void 0})(e,t,r)} /** * @license * Copyright 2017 Google LLC * SPDX-License-Identifier: BSD-3-Clause */function pe(e){return he({...e,state:!0,attribute:!1})}class ue{constructor(e){this.config={timeout:3e4,retryAttempts:3,...e},this.defaultHeaders={"Content-Type":"application/json","X-API-Key":e.apiKey}}setBusinessContext(e){this.config.businessId=e}getBusinessContext(){return this.config.businessId}async request(e,t={}){const r=`${this.config.baseURL}${e}`,s={...this.defaultHeaders,...t.headers},i={...t,headers:s,signal:AbortSignal.timeout(this.config.timeout)};try{const e=await fetch(r,i);if(!e.ok){const t=await e.json().catch(()=>({}));return{success:!1,error:t.error||`HTTP ${e.status}: ${e.statusText}`,details:t.details}}return{success:!0,data:await e.json()}}catch(e){return console.error("API Request failed:",e),{success:!1,error:e instanceof Error?e.message:"Network error occurred"}}}async getBusinesses(){return this.request("/v1/businesses/")}async getBusiness(e){return this.request(`/v1/businesses/${e}/`)}async createBusiness(e){return this.request("/v1/businesses/",{method:"POST",body:JSON.stringify(e)})}async updateBusiness(e,t){return this.request(`/v1/businesses/${e}/`,{method:"PUT",body:JSON.stringify(t)})}async getBusinessStats(e){return this.request(`/v1/businesses/${e}/stats/`)}async lookupBusinessByExternalId(e){return this.request(`/v1/businesses/lookup/?external_id=${encodeURIComponent(e)}`)}async getInvoices(e,t){const r=new URLSearchParams({business_id:e});return t?.status&&r.append("status",t.status),t?.customer_id&&r.append("customer_id",t.customer_id),t?.date_from&&r.append("date_from",t.date_from),t?.date_to&&r.append("date_to",t.date_to),t?.overdue&&r.append("overdue","true"),t?.outstanding&&r.append("outstanding","true"),t?.search&&r.append("search",t.search),this.request(`/invoices/?${r.toString()}`)}async getInvoice(e){return this.request(`/invoices/${e}/`)}async createInvoice(e){return this.request("/invoices/",{method:"POST",body:JSON.stringify(e)})}async updateInvoice(e,t){return this.request(`/invoices/${e}/`,{method:"PUT",body:JSON.stringify(t)})}async deleteInvoice(e){return this.request(`/invoices/${e}/`,{method:"DELETE"})}async recordInvoicePayment(e,t){return this.request(`/invoices/${e}/payment/`,{method:"POST",body:JSON.stringify(t)})}async sendInvoice(e){return this.request(`/invoices/${e}/send/`,{method:"POST"})}async getInvoicePayments(e){return this.request(`/invoices/${e}/payments/list/`)}async getCustomers(e){return this.request(`/customers/?business_id=${e}`)}async getCustomer(e){return this.request(`/customers/${e}/`)}async createCustomer(e){return this.request("/customers/",{method:"POST",body:JSON.stringify(e)})}async updateCustomer(e,t){return this.request(`/customers/${e}/`,{method:"PUT",body:JSON.stringify(t)})}async archiveCustomer(e){return this.request(`/customers/${e}/archive/`,{method:"POST"})}async reactivateCustomer(e){return this.request(`/customers/${e}/reactivate/`,{method:"POST"})}async getAccounts(e,t){const r=new URLSearchParams({business_id:e});return t?.account_type&&r.append("account_type",t.account_type),void 0!==t?.is_active&&r.append("is_active",t.is_active.toString()),t?.search&&r.append("search",t.search),this.request(`/accounts/?${r.toString()}`)}async getAccount(e){return this.request(`/accounts/${e}/`)}async createAccount(e){return this.request("/accounts/",{method:"POST",body:JSON.stringify(e)})}async updateAccount(e,t){return this.request(`/accounts/${e}/`,{method:"PUT",body:JSON.stringify(t)})}async deleteAccount(e){return this.request(`/accounts/${e}/`,{method:"DELETE"})}async getBankAccounts(e){return this.request(`/accounts/bank/?business_id=${e}`)}async getAccountHierarchy(e){return this.request(`/accounts/hierarchy/?business_id=${e}`)}async syncAccount(e){return this.request(`/accounts/${e}/sync/`,{method:"POST"})}async getPayments(e,t){const r=new URLSearchParams({business_id:e});return t?.status&&r.append("status",t.status),t?.customer_id&&r.append("customer_id",t.customer_id),t?.date_from&&r.append("date_from",t.date_from),t?.date_to&&r.append("date_to",t.date_to),t?.search&&r.append("search",t.search),this.request(`/payments/?${r.toString()}`)}async getPayment(e){return this.request(`/payments/${e}/`)}async createPayment(e){return this.request("/payments/",{method:"POST",body:JSON.stringify(e)})}async updatePayment(e,t){return this.request(`/payments/${e}/`,{method:"PUT",body:JSON.stringify(t)})}async completePayment(e){return this.request(`/payments/${e}/complete/`,{method:"POST"})}async failPayment(e){return this.request(`/payments/${e}/fail/`,{method:"POST"})}async getBalanceSheet(e,t){const r=new URLSearchParams({business_id:e});return t&&r.append("effective_date",t),this.request(`/reports/balance-sheet/?${r.toString()}`)}async getPnLData(e,t,r){const s=new URLSearchParams({business_id:e,date_from:t,date_to:r});return this.request(`/reports/pnl/?${s.toString()}`)}async getCashFlowData(e,t,r){const s=new URLSearchParams({business_id:e,date_from:t,date_to:r});return this.request(`/reports/cash-flow/?${s.toString()}`)}async healthCheck(){return this.request("/health/")}formatCurrency(e,t="GBP"){const r="number"==typeof e?e:parseFloat(e.toString());return new Intl.NumberFormat("en-GB",{style:"currency",currency:t}).format(r)}formatDate(e){return new Date(e).toLocaleDateString("en-GB",{year:"numeric",month:"short",day:"numeric"})}validateBusinessAccess(e){return this.config.businessId===e||!!e}handleApiError(e){let t="An unexpected error occurred";return 401===e.response?.status?t="Authentication failed. Check your API key.":404===e.response?.status?t="Business not found or not accessible.":403===e.response?.status?t="Permission denied. Business not accessible.":e.response?.data?.error&&(t=e.response.data.error),{success:!1,error:t,details:e.response?.data?.details}}}class me extends ne{constructor(){super(...arguments),this.apiKey="",this.businessId="",this.theme="light",this.baseUrl="http://localhost:8000/api",this.loading=!1,this.error=null,this.apiClient=null}connectedCallback(){super.connectedCallback(),this.initializeApiClient(),this.loadData()}initializeApiClient(){if("undefined"!=typeof window&&window.FridayProvider){const e=window.FridayProvider.getApiClient();if(e)return void(this.apiClient=e);const t=window.FridayProvider.getWidgetConfig();if(t)return void(this.apiClient=new ue({baseURL:t.baseUrl,apiKey:t.apiKey,businessId:t.businessId}))}this.apiKey?this.apiClient=new ue({baseURL:this.baseUrl,apiKey:this.apiKey,businessId:this.businessId||void 0}):this.setError("API key is required. Configure FridayProvider or provide api-key attribute.")}async loadData(){}setError(e){if(this.error=e,this.loading=!1,this.emitEvent("error",{message:e}),"undefined"!=typeof window&&window.FridayProvider)try{window.FridayProvider.handleError(new Error(e))}catch(e){}}clearError(){this.error=null}handleApiError(e,t="API request"){let r=`${t} failed`;e?.error?r=e.error:e?.message?r=e.message:"string"==typeof e&&(r=e),e?.details&&(r+=` (${e.details})`),this.setError(r),this.emitEvent("api-error",{context:t,error:e,message:r})}async makeApiRequest(e,t="Request"){try{if(this.setLoading(!0),!this.apiClient)throw new Error("API client not initialized");const r=await e();return r.success?(this.clearError(),r.data||null):(this.handleApiError(r,t),null)}catch(e){return this.handleApiError(e,t),null}finally{this.setLoading(!1)}}setLoading(e){this.loading=e,e&&this.clearError()}emitEvent(e,t={}){const r={type:e,data:t,timestamp:Date.now()};this.dispatchEvent(new CustomEvent(`friday-${e}`,{detail:r,bubbles:!0,composed:!0}))}renderLoading(){return B` <div class="Friday__loading"> <div class="Friday__spinner"></div> <span>Loading...</span> </div> `}renderError(){return B` <div class="Friday__error"> <span>⚠️ ${this.error}</span> </div> `}static get baseStyles(){return n` @import url('https://rsms.me/inter/inter.css'); :host { display: block; /* Friday Design System - Layer Financial Inspired */ --color-black: #1a1a1a; --color-white: white; --color-info: #0968f8; --color-info-bg: #d6e6ff; --color-info-fg: #0056d7; --color-success: hsl(145deg 45% 42%); --color-success-bg: hsl(145deg 59% 86%); --color-success-fg: hsl(145deg 63% 29%); --color-warning: hsl(43deg 100% 44%); --color-warning-bg: hsl(43deg 100% 84%); --color-warning-fg: hsl(43deg 88% 26%); --color-error: hsl(0deg 76% 50%); --color-error-bg: hsl(0deg 83% 86%); --color-error-fg: hsl(0deg 88% 32%); --color-dark-h: 220; --color-dark-s: 15%; --color-dark-l: 7%; --color-dark: hsl(var(--color-dark-h) var(--color-dark-s) var(--color-dark-l)); --color-base-0: #fff; --color-base-50: hsl(var(--color-dark-h) 5% 98%); --color-base-100: hsl(var(--color-dark-h) 5% 95%); --color-base-200: hsl(var(--color-dark-h) 5% 91%); --color-base-300: hsl(var(--color-dark-h) 6% 85%); --color-base-400: hsl(var(--color-dark-h) 7% 75%); --color-base-500: hsl(var(--color-dark-h) 8% 50%); --color-base-600: hsl(var(--color-dark-h) 10% 40%); --color-base-700: hsl(var(--color-dark-h) 12% 27%); --color-base-800: hsl(var(--color-dark-h) 15% 20%); --color-base-900: hsl(var(--color-dark-h) 18% 14%); --text-color-primary: var(--color-dark); --text-color-secondary: var(--color-base-600); --text-color-muted: var(--color-base-500); --text-color-inverse: var(--color-white); --bg-primary: var(--color-base-0); --bg-secondary: var(--color-base-50); --bg-tertiary: var(--color-base-100); --bg-element-hover: var(--color-base-100); --border-primary: var(--color-base-200); --border-secondary: var(--color-base-300); --border-focus: var(--color-info); --font-family: 'InterVariable', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; --text-2xs: 10px; --text-xs: 11px; --text-sm: 12px; --text-md: 14px; --text-lg: 16px; --text-xl: 18px; --text-2xl: 20px; --text-3xl: 24px; --font-weight-normal: 460; --font-weight-medium: 500; --font-weight-semibold: 540; --font-weight-bold: 600; --spacing-2xs: 6px; --spacing-xs: 8px; --spacing-sm: 12px; --spacing-md: 16px; --spacing-lg: 20px; --spacing-xl: 24px; --spacing-2xl: 32px; --spacing-3xl: 40px; --spacing-4xl: 48px; --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px; --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); --transition-fast: 150ms ease; } .Friday__component { font-family: var(--font-family); font-size: var(--text-md); line-height: 1.5; color: var(--text-color-primary); background: var(--bg-primary); border: 1px solid var(--border-primary); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); overflow: hidden; } .Friday__loading { display: flex; align-items: center; justify-content: center; padding: var(--spacing-4xl); color: var(--text-color-muted); font-size: var(--text-sm); gap: var(--spacing-xs); } .Friday__spinner { width: 20px; height: 20px; border: 2px solid var(--border-primary); border-top-color: var(--color-info); border-radius: 50%; animation: Friday__spin 1s linear infinite; } @keyframes Friday__spin { to { transform: rotate(360deg); } } .Friday__error { display: flex; align-items: center; gap: var(--spacing-xs); padding: var(--spacing-md); margin: var(--spacing-md); background: var(--color-error-bg); color: var(--color-error-fg); border: 1px solid var(--color-error); border-radius: var(--radius-sm); font-size: var(--text-sm); } .Friday__header { display: flex; align-items: center; justify-content: space-between; padding: var(--spacing-lg) var(--spacing-xl); border-bottom: 1px solid var(--border-primary); background: var(--bg-secondary); } .Friday__header-title { font-size: var(--text-xl); font-weight: var(--font-weight-semibold); color: var(--text-color-primary); margin: 0; } .Friday__header-actions { display: flex; align-items: center; gap: var(--spacing-sm); } .Friday__content { padding: var(--spacing-xl); } .Friday__button { display: inline-flex; align-items: center; justify-content: center; gap: var(--spacing-xs); padding: var(--spacing-xs) var(--spacing-md); border: 1px solid transparent; border-radius: var(--radius-sm); font-family: var(--font-family); font-size: var(--text-sm); font-weight: var(--font-weight-medium); line-height: 1.5; text-decoration: none; cursor: pointer; transition: all var(--transition-fast); white-space: nowrap; user-select: none; } .Friday__button:disabled { opacity: 0.5; cursor: not-allowed; } .Friday__button--primary { background: var(--color-info); color: var(--text-color-inverse); border-color: var(--color-info); } .Friday__button--primary:hover:not(:disabled) { background: var(--color-info-fg); border-color: var(--color-info-fg); } .Friday__button--secondary { background: var(--bg-primary); color: var(--text-color-primary); border-color: var(--border-primary); } .Friday__button--secondary:hover:not(:disabled) { background: var(--bg-element-hover); border-color: var(--border-secondary); } .Friday__button--success { background: var(--color-success); color: var(--text-color-inverse); border-color: var(--color-success); } .Friday__button--success:hover:not(:disabled) { background: var(--color-success-fg); border-color: var(--color-success-fg); } .Friday__button--error { background: var(--color-error); color: var(--text-color-inverse); border-color: var(--color-error); } .Friday__button--sm { padding: var(--spacing-2xs) var(--spacing-sm); font-size: var(--text-xs); } .Friday__input { display: block; width: 100%; padding: var(--spacing-xs) var(--spacing-sm); border: 1px solid var(--border-primary); border-radius: var(--radius-sm); font-family: var(--font-family); font-size: var(--text-sm); line-height: 1.5; color: var(--text-color-primary); background: var(--bg-primary); transition: all var(--transition-fast); } .Friday__input:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px hsla(217, 100%, 50%, 0.1); } .Friday__select { display: block; width: 100%; padding: var(--spacing-xs) var(--spacing-sm); border: 1px solid var(--border-primary); border-radius: var(--radius-sm); font-family: var(--font-family); font-size: var(--text-sm); color: var(--text-color-primary); background: var(--bg-primary); cursor: pointer; transition: all var(--transition-fast); } .Friday__table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); } .Friday__table th, .Friday__table td { padding: var(--spacing-sm) var(--spacing-md); text-align: left; border-bottom: 1px solid var(--border-primary); } .Friday__table th { font-weight: var(--font-weight-semibold); color: var(--text-color-secondary); background: var(--bg-secondary); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; } .Friday__table tbody tr:hover { background: var(--bg-element-hover); } .Friday__badge { display: inline-flex; align-items: center; padding: 2px var(--spacing-xs); border-radius: 9999px; font-size: var(--text-2xs); font-weight: var(--font-weight-medium); text-transform: uppercase; letter-spacing: 0.05em; } .Friday__badge--success { background: var(--color-success-bg); color: var(--color-success-fg); } .Friday__badge--warning { background: var(--color-warning-bg); color: var(--color-warning-fg); } .Friday__badge--error { background: var(--color-error-bg); color: var(--color-error-fg); } .Friday__badge--info { background: var(--color-info-bg); color: var(--color-info-fg); } /* Typography utilities */ .Friday__text-xs { font-size: var(--text-xs); } .Friday__text-sm { font-size: var(--text-sm); } .Friday__text-md { font-size: var(--text-md); } .Friday__text-lg { font-size: var(--text-lg); } .Friday__text-muted { color: var(--text-color-muted); } .Friday__text-secondary { color: var(--text-color-secondary); } .Friday__font-medium { font-weight: var(--font-weight-medium); } .Friday__font-semibold { font-weight: var(--font-weight-semibold); } .Friday__font-bold { font-weight: var(--font-weight-bold); } @media (max-width: 768px) { .Friday__component { border-radius: 0; border-left: none; border-right: none; box-shadow: none; } .Friday__header { padding: var(--spacing-md) var(--spacing-lg); } .Friday__content { padding: var(--spacing-lg); } .Friday__table th, .Friday__table td { padding: var(--spacing-xs) var(--spacing-sm); } } `}}return t([he({type:String,attribute:"api-key"})],me.prototype,"apiKey",void 0),t([he({type:String,attribute:"business-id"})],me.prototype,"businessId",void 0),t([he({type:String})],me.prototype,"theme",void 0),t([he({type:String,attribute:"base-url"})],me.prototype,"baseUrl",void 0),t([pe()],me.prototype,"loading",void 0),t([pe()],me.prototype,"error",void 0),e.PnLTableWidget=class extends me{constructor(){super(...arguments),this.lockExpanded=!1,this.stringOverrides={grossProfitLabel:"Gross Profit",profitBeforeTaxesLabel:"Profit before taxes",netProfitLabel:"Net Profit"},this.showDemo=!1,this.tableData=null,this.expandedItems=new Set}static get styles(){return[me.baseStyles,n` .Friday__pnl-table-container { padding: var(--spacing-lg); } .Friday__pnl-table-wrapper { background: var(--bg-primary); border: 1px solid var(--border-primary); border-radius: var(--radius-md); overflow: hidden; } .Friday__pnl-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); } .Friday__pnl-table-header { background: var(--bg-secondary); border-bottom: 2px solid var(--border-primary); } .Friday__pnl-table-header th { padding: var(--spacing-lg) var(--spacing-md); text-align: left; font-weight: var(--font-weight-semibold); color: var(--text-color-primary); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.05em; } .Friday__pnl-table-header th:last-child { text-align: right; } .Friday__pnl-table-row { border-bottom: 1px solid var(--border-primary); transition: background-color var(--transition-fast); } .Friday__pnl-table-row:hover { background: var(--bg-element-hover); } .Friday__pnl-table-row--level-0 { background: var(--bg-secondary); font-weight: var(--font-weight-semibold); } .Friday__pnl-table-row--level-1 { background: var(--bg-primary); } .Friday__pnl-table-row--level-2 { background: var(--bg-primary); color: var(--text-color-secondary); } .Friday__pnl-table-row--total { background: var(--color-info-bg); border-top: 2px solid var(--color-info); font-weight: var(--font-weight-bold); } .Friday__pnl-table-row--subtotal { background: var(--bg-tertiary); border-top: 1px solid var(--border-secondary); font-weight: var(--font-weight-semibold); } .Friday__pnl-table-cell { padding: var(--spacing-md); vertical-align: middle; } .Friday__pnl-table-cell--amount { text-align: right; font-family: var(--font-family-numeric); font-weight: var(--font-weight-medium); } .Friday__pnl-table-cell--amount.positive { color: var(--color-success-fg); } .Friday__pnl-table-cell--amount.negative { color: var(--color-error-fg); } .Friday__pnl-item-name { display: flex; align-items: center; gap: var(--spacing-xs); } .Friday__pnl-expand-button { width: 20px; height: 20px; border: none; background: transparent; color: var(--text-color-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); transition: all var(--transition-fast); font-size: 12px; } .Friday__pnl-expand-button:hover { background: var(--bg-element-hover); color: var(--text-color-primary); } .Friday__pnl-expand-button:disabled { opacity: 0.3; cursor: not-allowed; } .Friday__pnl-expand-button.expanded { transform: rotate(90deg); } .Friday__pnl-item-indent { height: 1px; } .Friday__demo-notice { background: var(--color-info-bg); border: 1px solid var(--color-info); color: var(--color-info-fg); padding: var(--spacing-md); border-radius: var(--radius-sm); margin: var(--spacing-lg); font-size: var(--text-sm); text-align: center; } .Friday__pnl-summary { padding: var(--spacing-lg); background: var(--bg-secondary); border-top: 1px solid var(--border-primary); display: flex; justify-content: space-between; align-items: center; font-size: var(--text-sm); color: var(--text-color-secondary); } @media (max-width: 768px) { .Friday__pnl-table-container { padding: var(--spacing-md); } .Friday__pnl-table-cell { padding: var(--spacing-sm); } .Friday__pnl-table-header th { padding: var(--spacing-md) var(--spacing-sm); } } `]}async loadData(){if(this.apiClient){this.setLoading(!0);try{this.showDemo,this.loadDemoData(),this.lockExpanded&&this.expandAllItems(),this.emitEvent("pnl-table-loaded",{data:this.tableData})}catch(e){this.setError("Failed to load P&L table data")}finally{this.setLoading(!1)}}}loadDemoData(){this.tableData={period:"January 1 - December 31, 2024",income:{id:"income",name:"Income",amount:5e5,level:0,type:"category",children:[{id:"sales",name:"Sales Revenue",amount:45e4,level:1,type:"item",children:[{id:"product_sales",name:"Product Sales",amount:3e5,level:2,type:"item"},{id:"service_sales",name:"Service Sales",amount:15e4,level:2,type:"item"}]},{id:"other_income",name:"Other Income",amount:5e4,level:1,type:"item",children:[{id:"interest",name:"Interest Income",amount:25e3,level:2,type:"item"},{id:"misc",name:"Miscellaneous Income",amount:25e3,level:2,type:"item"}]}]},costOfGoodsSold:{id:"cogs",name:"Cost of Goods Sold",amount:2e5,level:0,type:"category",children:[{id:"materials",name:"Raw Materials",amount:12e4,level:1,type:"item"},{id:"labor",name:"Direct Labor",amount:8e4,level:1,type:"item"}]},grossProfit:{id:"gross_profit",name:this.stringOverrides.grossProfitLabel,amount:3e5,level:0,type:"subtotal"},expenses:{id:"expenses",name:"Operating Expenses",amount:18e4,level:0,type:"category",children:[{id:"admin",name:"Administrative Expenses",amount:1e5,level:1,type:"item",children:[{id:"office_rent",name:"Office Rent",amount:6e4,level:2,type:"item"},{id:"utilities",name:"Utilities",amount:24e3,level:2,type:"item"},{id:"insurance",name:"Insurance",amount:16e3,level:2,type:"item"}]},{id:"marketing",name:"Marketing & Sales",amount:8e4,level:1,type:"item",children:[{id:"advertising",name:"Advertising",amount:45e3,level:2,type:"item"},{id:"sales_commission",name:"Sales Commissions",amount:35e3,level:2,type:"item"}]}]},profitBeforeTaxes:{id:"profit_before_taxes",name:this.stringOverrides.profitBeforeTaxesLabel,amount:12e4,level:0,type:"subtotal"},netProfit:{id:"net_profit",name:this.stringOverrides.netProfitLabel,amount:85e3,level:0,type:"total"}}}expandAllItems(){if(!this.tableData)return;const e=t=>{t.children&&t.children.length>0&&(this.expandedItems.add(t.id),t.children.forEach(e))};[this.tableData.income,this.tableData.costOfGoodsSold,this.tableData.expenses].forEach(e)}toggleExpand(e){this.lockExpanded||(this.expandedItems.has(e)?this.expandedItems.delete(e):this.expandedItems.add(e),this.requestUpdate())}isExpanded(e){return this.expandedItems.has(e)}getAmountClass(e){return e>0?"positive":e<0?"negative":""}renderTableRow(e,t=!0){const r=[],s=e.children&&e.children.length>0,i=this.isExpanded(e.id);return r.push(B` <tr class="Friday__pnl-table-row Friday__pnl-table-row--level-${e.level} Friday__pnl-table-row--${e.type}"> <td class="Friday__pnl-table-cell"> <div class="Friday__pnl-item-name"> <div class="Friday__pnl-item-indent" style="width: ${20*e.level}px;"></div> ${s?B` <button class="Friday__pnl-expand-button ${i?"expanded":""}" ?disabled=${this.lockExpanded} @click=${()=>this.toggleExpand(e.id)} > ▶ </button> `:B`<div style="width: 20px;"></div>`} ${e.name} </div> </td> <td class="Friday__pnl-table-cell Friday__pnl-table-cell--amount ${this.getAmountClass(e.amount)}"> ${this.apiClient?.formatCurrency(100*Math.abs(e.amount),"GBP")} </td> </tr> `),s&&t&&(i||this.lockExpanded)&&e.children.forEach(e=>{r.push(...this.renderTableRow(e,!0))}),r}renderAllRows(){if(!this.tableData)return[];const e=[];return e.push(...this.renderTableRow(this.tableData.income)),e.push(...this.renderTableRow(this.tableData.costOfGoodsSold)),e.push(...this.renderTableRow(this.tableData.grossProfit,!1)),e.push(...this.renderTableRow(this.tableData.expenses)),e.push(...this.renderTableRow(this.tableData.profitBeforeTaxes,!1)),e.push(...this.renderTableRow(this.tableData.netProfit,!1)),e}render(){return this.loading?B`<div class="Friday__component">${this.renderLoading()}</div>`:this.error?B`<div class="Friday__component">${this.renderError()}</div>`:B` <div class="Friday__component"> <div class="Friday__header"> <h2 class="Friday__header-title">Profit & Loss Statement</h2> </div> ${this.showDemo?B` <div class="Friday__demo-notice"> <strong>Demo Mode:</strong> Showing sample P&L table data </div> `:""} <div class="Friday__pnl-table-container"> <div class="Friday__pnl-table-wrapper"> <table class="Friday__pnl-table"> <thead class="Friday__pnl-table-header"> <tr> <th>Account</th> <th>Amount</th> </tr> </thead> <tbody> ${this.renderAllRows()} </tbody> </table> </div> ${this.tableData?B` <div class="Friday__pnl-summary"> <span>Period: ${this.tableData.period}</span> <span> ${this.lockExpanded?"All items expanded":"Click items to expand/collapse"} </span> </div> `:""} </div> </div> `}},t([he({type:Boolean,attribute:"lock-expanded"})],e.PnLTableWidget.prototype,"lockExpanded",void 0),t([he({type:Object})],e.PnLTableWidget.prototype,"stringOverrides",void 0),t([he({type:Boolean,attribute:"show-demo"})],e.PnLTableWidget.prototype,"showDemo",void 0),t([pe()],e.PnLTableWidget.prototype,"tableData",void 0),t([pe()],e.PnLTableWidget.prototype,"expandedItems",void 0),e.PnLTableWidget=t([(e=>(t,r)=>{void 0!==r?r.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)})("friday-pnl-table-widget")],e.PnLTableWidget),e}({});