1import{b as L,c as U}from"./chunk-TEVBECQJ.js";import{a as N}from"./chunk-AUKIETH2.js";import{f as P,k as V,w as A}from"./chunk-P625IRAL.js";import{l as D}from"./chunk-GL4YR33V.js";import{b as F}from"./chunk-JXLBD2WL.js";import"./chunk-RUU34CC4.js";import{b as z,d as B}from"./chunk-NKL6YEJH.js";import"./chunk-B3KA3REB.js";import{m as j,r as T,x as H}from"./chunk-PR5NJDMR.js";import{Eb as m,Fb as k,Ob as l,Qb as C,Ub as y,Vb as _,Wa as u,Wb as M,Xa as a,Yb as S,ac as R,bc as E,da as b,mb as x,na as q,oa as g,ob as f,pa as v,pc as I,ub as i,vb as r,wb as h,zb as w}from"./chunk-4IAM5SFH.js";import{j as d}from"./chunk-5TH5JFSU.js";function G(s,n){if(s&1){let W=w();i(0,"button",17),m("click",function(){q(W);let o=k();return g(o.openHelpModal())}),v(),i(1,"svg",18),h(2,"path",19),r(),l(3," Help "),r()}}var le=(()=>{let n=class n{constructor(e,o,t,p,c,Q){this.supabase=e,this.route=o,this.router=t,this.toastr=p,this.cdr=c,this.auth=Q,this.chairman=!1,this.activeRule=null,this.newContent="",this.ruleName="Test Rule",this.modules={toolbar:[["bold","italic","underline","strike"],["blockquote","code-block"],[{header:1},{header:2}],[{list:"ordered"},{list:"bullet"}],[{script:"sub"},{script:"super"}],[{indent:"-1"},{indent:"+1"}],[{direction:"rtl"}],[{size:["small",!1,"large","huge"]}],[{header:[1,2,3,4,5,6,!1]}],[{color:[]},{background:[]}],[{font:[]}],[{align:[]}],["clean"],["link","image"]]}}ngOnInit(){return d(this,null,function*(){yield this.fetchProfile(),yield this.getContent()})}fetchProfile(){return d(this,null,function*(){if(!this.auth.session?.user)return;let{data:e,error:o}=yield this.supabase.supabase.from("profiles").select("role").eq("id",this.auth.session.user.id);if(o){console.error(o);return}e&&e[0]?.role==="chairman"&&(this.chairman=!0)})}getContent(){return d(this,null,function*(){let e=this.route.snapshot.paramMap.get("id"),{data:o,error:t}=yield this.supabase.supabase.from("rules").select("*").eq("id",e).single();if(t){console.error(t),this.toastr.error("Failed to fetch rule","Error");return}this.activeRule=o,this.activeRule?.content&&(this.newContent=this.activeRule.content)})}updateContent(){return d(this,null,function*(){if(!this.activeRule?.id)throw new Error("No selected rule");let{error:e}=yield this.supabase.supabase.from("rules").update({content:this.newContent}).eq("id",this.activeRule.id).single();e?(console.error(e),this.toastr.error("Failed to update content","Error")):(this.newContent="",this.toastr.success("Content updated successfully","Success"),this.getContent(),this.cdr.detectChanges())})}openHelpModal(){let e=document.getElementById("helpModal");e&&e.classList.add("modal-open")}closeHelpModal(){let e=document.getElementById("helpModal");e&&e.classList.remove("modal-open")}};n.\u0275fac=function(o){return new(o||n)(a(F),a(z),a(B),a(D),a(I),a(N))},n.\u0275cmp=b({type:n,selectors:[["app-rules-cms"]],standalone:!0,features:[S],decls:26,vars:6,consts:[[1,"min-h-screen","p-6","lg:p-10"],[1,"max-w-7xl","mx-auto","bg-base-300","rounded-xl","shadow-xl","overflow-hidden"],[1,"p-6","lg:p-10"],[1,"flex","justify-between","items-center","mb-8"],[1,"text-3xl","font-bold","text-base-content"],[1,"flex","gap-2"],["class","btn btn-secondary hover:btn-accent transition-colors duration-300 flex items-center gap-2 px-4 py-2 rounded-lg shadow-md",3,"click",4,"ngIf"],[1,"btn","btn-primary",3,"click"],[1,"bg-base-200","p-4","rounded-lg","shadow-lg","pb-[65px]"],[1,"w-full","max-w-[1100px]","mx-auto","h-fit"],[1,"quill-editor-custom","bg-base-100","rounded-lg",2,"height","450px",3,"ngModelChange","modules","ngModel"],["id","helpModal",1,"modal"],[1,"modal-box","max-w-4xl","w-11/12"],[1,"font-bold","text-lg"],["controls","",1,"w-full","mt-4","rounded-lg"],["src","https://qxoroicvatularpyltbx.supabase.co/storage/v1/object/public/Images/D14-Demo-Chairman.mp4","type","video/mp4"],[1,"modal-action"],[1,"btn","btn-secondary","hover:btn-accent","transition-colors","duration-300","flex","items-center","gap-2","px-4","py-2","rounded-lg","shadow-md",3,"click"],["xmlns","http://www.w3.org/2000/svg","fill","none","viewBox","0 0 24 24","stroke","black",1,"h-5","w-5"],["stroke-linecap","round","stroke-linejoin","round","stroke-width","2","d","M8.228 9c.549-1.165 2.03-2 3.772-2 2.21 0 4 1.343 4 3 0 1.4-1.278 2.575-3.006 2.907-.542.104-.994.54-.994 1.093m0 3h.01M12 21a9 9 0 100-18 9 9 0 000 18z"]],template:function(o,t){o&1&&(i(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"h2",4),l(5),R(6,"uppercase"),r(),i(7,"div",5),x(8,G,4,0,"button",6),i(9,"button",7),m("click",function(){return t.updateContent()}),l(10," SAVE "),r()()(),i(11,"div",8)(12,"div",9)(13,"quill-editor",10),M("ngModelChange",function(c){return _(t.newContent,c)||(t.newContent=c),c}),r()()()()()(),i(14,"div",11)(15,"div",12)(16,"h3",13),l(17,"Help"),r(),i(18,"p"),l(19,"Use the video below to learn how to edit the CMS for your division."),r(),i(20,"video",14),h(21,"source",15),l(22," Your browser does not support the video tag. "),r(),i(23,"div",16)(24,"button",7),m("click",function(){return t.closeHelpModal()}),l(25,"Close"),r()()()()),o&2&&(u(5),C(" ",E(6,4,t.activeRule==null?null:t.activeRule.name)," "),u(3),f("ngIf",t.chairman),u(5),f("modules",t.modules),y("ngModel",t.newContent))},dependencies:[H,j,T,U,L,A,P,V],styles:[".ql-toolbar{border-radius:12px} .ql-toolbar .ql-formats button, .ql-toolbar .ql-picker-label, .ql-toolbar .ql-picker-item, .ql-toolbar .ql-formats .ql-picker{color:#fff!important;fill:#fff!important;stroke:#fff!important;background:none!important;border:none!important} .ql-toolbar .ql-formats button:hover, .ql-toolbar .ql-formats button:focus, .ql-toolbar .ql-formats button.ql-active, .ql-toolbar .ql-picker-label:hover, .ql-toolbar .ql-picker-label:focus, .ql-toolbar .ql-picker-label.ql-active, .ql-toolbar .ql-picker-item:hover, .ql-toolbar .ql-picker-item:focus, .ql-toolbar .ql-picker-item.ql-active, .ql-toolbar .ql-formats .ql-picker:hover, .ql-toolbar .ql-formats .ql-picker:focus, .ql-toolbar .ql-formats .ql-picker.ql-active{color:#fff!important;fill:#fff!important;stroke:#fff!important} .ql-toolbar svg{fill:#fff!important;stroke:#fff!important} .ql-toolbar .ql-stroke{stroke:#fff!important} .ql-toolbar .ql-fill{fill:#fff!important} .ql-toolbar .ql-even{fill:#fff!important;stroke:#fff!important} .ql-toolbar .ql-picker-options{border:none!important} .ql-picker-options{background:#000000bf!important;border-radius:12px;padding:8px;box-shadow:0 4px 8px #0000001a} .quill-editor-custom{height:100%} .quill-editor-custom .ql-container{background:#000000bf;border-radius:12px;padding:16px;height:100%;box-sizing:border-box} .quill-editor-custom .ql-editor{color:#fff;font-weight:500;font-size:16px;font-family:Satoshi;height:calc(100% - 32px);box-sizing:border-box} .quill-editor-custom h1, .quill-editor-custom h2, .quill-editor-custom h3, .quill-editor-custom h4, .quill-editor-custom h5, .quill-editor-custom h6{font-family:Mersad}"]});let s=n;return s})();export{le as RulesComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.